Commit Graph

27 Commits

Author SHA1 Message Date
Pierre-Yves David
a29094b506 color: update main documentation
Now that the feature no longer lives in the extension, we document it in the
help of the core config. This include the new 'ui.color' option introduced in
the previous changesets.

As a result the color extensions can now be deprecated.

This is a documentation patch only; color is still disabled by default.
2017-02-21 20:04:55 +01:00
Pierre-Yves David
df8accc45d color: rename '_styles' to '_defaultstyles' for clarity
This should make it clear the dict is only used for new config. Extensions
should not modify it directly anyway since we have 'extraloader' logic for
loading '_styles' too.
2016-11-06 20:16:54 +01:00
Pierre-Yves David
23a62914d0 color: move 'styles' definition on the 'ui' object
Same logic as for '_terminfoparams'. The content depends on the config so it
should be specific to each 'ui instance.
2016-11-06 20:16:01 +01:00
Pierre-Yves David
da62a3693e color: pass 'ui' to 'win32print'
Same logic as before,'win32print' relies on some data we will move on the 'ui'
object soon, we update the API beforehand for clarity.
2016-11-06 20:10:53 +01:00
Pierre-Yves David
ae9d790b11 color: move the dict with terminfo parameters on the ui object
This dictionnary is affected by the content of the config, so we should have
one for each ui config.

We rename the global dict to '_baseterminfoparams' to make the situation
clearer.
2017-02-25 15:00:51 +01:00
Pierre-Yves David
899a2d4ada color: add ui to effect rendering
We'll carry more and more color specific data on the ui object. This will help
isolating different color configuration from each other. For example repository
config might configure special style that should not affect other ui object.

The first step is to make sure the ui object is available were we will needs it.
2017-02-25 15:00:44 +01:00
Pierre-Yves David
b29eb57306 color: add a 'ui.color' option to control color behavior
This new option control whether or not color will be used. It mirror the behavior
of '--color'. I usually avoid adding new option to '[ui]' as the section is
already filled with many option. However, I feel like 'color' is central enough
to deserves a spot in this '[ui]' section.

For now the option is not documented so it is still marked as experimental. Once
it get documented and official, we should be able to deprecate the color
extensions.

There is more cleanup to do before that documentation is written, but we need
this option early to made them. Having that option will allow for more cleanup
of the initialisation process and proper separation between color
configuration.
2017-02-25 19:44:23 +01:00
Pierre-Yves David
48a235c8c6 color: reinvent dictionary
move the module lever dictionary declaration to a more standard (and practical
indentation)
2017-02-28 11:42:07 +01:00
Pierre-Yves David
00b25b244a color: have the 'ui' object carry the '_colormode' directly
Before this changeset, the value was carried by the class to work around
limitation of the extensions initialisation. Now that the initialisation is
cleanly handled in 'dispatch', we can drop this work around.
2017-02-21 18:22:07 +01:00
Pierre-Yves David
89576090e1 color: move triggering of the initialisation logic in core
We now run the color initialisation as part of the standard dispatch. This is
opening the way for multiple cleanups since we now have access to the multiple 'ui'
object and we'll be able to see difference between global and local config. This
cleanup will arrive in later changesets.

As a side effect, the '--color' flag is now working without the extension.

Since we now properly initialize color for each ui idependently, we get a
warning message twice.
2017-02-21 18:20:12 +01:00
Pierre-Yves David
678b643454 color: handle 'ui.plain()' directly in mode setup
If 'ui.plain()' is set we should not colorize. We move that logic into the
function that determine and setup the color mode. As all other code respect
the resulting mode this will be equivalent.
2017-02-21 17:51:43 +01:00
Pierre-Yves David
d02ff2c6a2 color: move 'modesetup' into the core module
Yet another piece of code moving from the extensions to the module in core!
2016-12-22 14:30:46 +01:00
Pierre-Yves David
edcce6b7a3 color: move 'terminfosetup' into the core module
Another step closer to have all the logic living in core
2016-12-22 14:17:52 +01:00
Pierre-Yves David
e346e78cd5 color: add multiple messages input support to 'win32print'
All other function doing writes support any number of input message. For
simplicity, we make 'win32print' able to do the same.
2017-02-24 21:34:07 +01:00
Pierre-Yves David
b094768dd3 color: clarify name of an argument of 'win32print'
In the current code, the function called to write happens to the 'orig' version
of the method calling 'win32print' (obtained with a 'super' call). However, the
variable could have a better name. That will be useful when we'll stop having
inheritance in play.
2017-02-24 21:31:47 +01:00
Pierre-Yves David
88e8699e8f color: move the 'colorlabel' function in the core module
The extract code is relocated in core.
2017-02-23 19:10:24 +01:00
Pierre-Yves David
3440ddf077 color: minor reversal of two conditional clause for clarity
Another minor cleanup while reading the code. The two branches of the conditional
have similar complexity so we go for the order that give us the simplest
condition (we drop the negation).
2016-12-22 13:19:12 +01:00
Pierre-Yves David
27dabab2f3 color: move 'win32' declaration to the core module
This is another part of moving color implementation into core. before we can
move the advance logic, we need to move the basic definition and building
bricks. This is one more step on that road.
2016-12-22 03:11:19 +01:00
Pierre-Yves David
d3cdbad5e6 color: move the '_render_effects' function to the core module 2016-12-22 02:38:53 +01:00
Pierre-Yves David
59ecec91a4 color: move '_effect_str' function into the core module 2016-12-22 02:37:18 +01:00
Pierre-Yves David
0f0fe390dc color: move configstyles into the core module
The extension is getting thinner as we speak!
2016-12-22 02:34:22 +01:00
Pierre-Yves David
e15ab34611 color: rework conditional 'valideffect'
Not very important, but the full conditional is not that hard to follow and
having it unified make the function role a bit clearer in my opinion.
2016-12-22 02:30:03 +01:00
Pierre-Yves David
fcd5d56250 color: move 'valideffect' function into the core module 2016-12-22 02:26:50 +01:00
Pierre-Yves David
98d6e487dc color: move '_terminfo_params' into the core 'color' module
On step closer to have color in core.
2016-12-22 02:23:23 +01:00
Pierre-Yves David
2c4222ad04 color: move '_effect' mapping into core
This is the second things we can move into core safely.
2016-11-18 18:48:38 +01:00
Pierre-Yves David
9ff835aa99 color: load 'colortable' from extension using an 'extraloader'
Now that we have the '_style' dictionary in core, we can use the clean and
standard 'extraloader' mechanism to load extension's 'colortable'.
color.loadcolortable
2016-11-18 18:18:15 +01:00
Pierre-Yves David
59221a2230 color: move hgext.color._styles to mercurial.color.style
This is small first step to start moving the color infrastructure into core. The
current code of the color extensions is full of strange and debatable things,
we'll clean it up in the process as having things into core help the cleaning.

Moving _style was the simplest sensible move that is possible. It will also help
cleaning up the extension setup process in a later changesets.
2016-11-18 18:09:36 +01:00