colorization

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

colorization

Markus Wanner-2
Hi,

I picked up the branch net.venge.monotone.colored-diff, brought it up to
speed (including the newish status output) and adapted the colorization
a bit to .. well .. my taste, I guess.

To argue a bit more objectively: I tried to make the default colors
readable on black as well as white background. And I reduced noise a bit
by un-coloring a couple of things. Colorization can be adjusted via a
lua hook.

I'd opt for enabling colorization by default. Especially as this feature
gets automatically disabled for non-smart terminals. Any objections?

Any specific wishes on how to paint this bike shed?

Regards

Markus Wanner

_______________________________________________
Monotone-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/monotone-devel
Reply | Threaded
Open this post in threaded view
|

Re: colorization

Markus Wanner-2
Hi,

On 03/30/2015 08:48 PM, Markus Wanner wrote:
> To argue a bit more objectively: I tried to make the default colors
> readable on black as well as white background. And I reduced noise a bit
> by un-coloring a couple of things. Colorization can be adjusted via a
> lua hook.

I just landed this branch on nvm. Together with some support for a
pager. Currently still hard-coded to 'less', but I intend to make this
configurable via lua.

> I'd opt for enabling colorization by default. Especially as this feature
> gets automatically disabled for non-smart terminals.

Both - colorization and paging - is now enabled by default for smart
terminals (for Linux/Unix systems, that is). I'd appreciate some feedback.

Regards

Markus Wanner



_______________________________________________
Monotone-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/monotone-devel

signature.asc (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: colorization

Tim Brownawell
On 04/09/2015 01:23 PM, Markus Wanner wrote:

> Hi,
>
> On 03/30/2015 08:48 PM, Markus Wanner wrote:
>> To argue a bit more objectively: I tried to make the default colors
>> readable on black as well as white background. And I reduced noise a bit
>> by un-coloring a couple of things. Colorization can be adjusted via a
>> lua hook.
> I just landed this branch on nvm. Together with some support for a
> pager. Currently still hard-coded to 'less', but I intend to make this
> configurable via lua.

Makes sense.

>> I'd opt for enabling colorization by default. Especially as this feature
>> gets automatically disabled for non-smart terminals.
> Both - colorization and paging - is now enabled by default for smart
> terminals (for Linux/Unix systems, that is). I'd appreciate some feedback.

Nothing in the diff jumps out at me as an issue.

    $ mtn log --colorize | less

No escape codes (good), but also no colors even tho I specifically asked
for them.

    $ ls -l --color | less -FRX

Other colorized commands will output the colorization codes if
specifically asked, even to pipes.

If --colorize is given explicitly, I'd think it should colorize
regardless of what it thinks the output type is.


_______________________________________________
Monotone-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/monotone-devel
Reply | Threaded
Open this post in threaded view
|

Re: colorization

Markus Wanner-2
Timothy,

thanks for testing.

On 04/12/2015 06:07 PM, Timothy Brownawell wrote:
> Nothing in the diff jumps out at me as an issue.
>
>    $ mtn log --colorize | less
>
> No escape codes (good), but also no colors even tho I specifically asked
> for them.

If you pipe to less, mtn isn't writing to a smart terminal, anymore.
That currently disables colorization independent of the option, yes.

> Other colorized commands will output the colorization codes if
> specifically asked, even to pipes.

That in turn surprises me.

    $ mtn diff --colorize | cat

gives monochrome output for me. What specific command and OS do you use?

> If --colorize is given explicitly, I'd think it should colorize
> regardless of what it thinks the output type is.

I see your point. And it seems that would be more consistent with how
'--ticker' works as well. I'll change that. Thanks for your input.

The same argument could be applied for '--pager', though, where I have a
bit of a hard time coming up with a valid use case.

Regards

Markus Wanner


_______________________________________________
Monotone-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/monotone-devel
Reply | Threaded
Open this post in threaded view
|

Re: colorization

Tim Brownawell
On 04/12/2015 01:59 PM, Markus Wanner wrote:
>> Other colorized commands will output the colorization codes if
>> specifically asked, even to pipes.
> That in turn surprises me.
>
>      $ mtn diff --colorize | cat
>
> gives monochrome output for me. What specific command and OS do you use?

Oops, I meant "other" as in "not monotone". With my example being "ls"
(which I have the GNU coreutils version, on current Debian testing).

>> If --colorize is given explicitly, I'd think it should colorize
>> regardless of what it thinks the output type is.
> I see your point. And it seems that would be more consistent with how
> '--ticker' works as well. I'll change that. Thanks for your input.
>
> The same argument could be applied for '--pager', though, where I have a
> bit of a hard time coming up with a valid use case.

Hm... --pager in general is a bit odd really, but maybe I'm just too
comfortable with unix pipelines.

--pager means, send the output thru this other program instead of to
normal STDOUT. Which does not make sense if STDOUT is being captured,
which can be approximated by STDOUT not being a smart terminal.

It also doesn't make much sense to give --pager explicitly, since piping
to your paging program does the same thing and is more consistent with
the rest of the world. Unless you're on Windows I guess?

That's a use case. Have --pager be a GUI program (notepad, whatever),
which doesn't output thru your terminal. In which case you probably want
it *especially* if your terminal isn't smart.

_______________________________________________
Monotone-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/monotone-devel
Reply | Threaded
Open this post in threaded view
|

Re: colorization

Markus Wanner-2
On 04/12/2015 09:15 PM, Timothy Brownawell wrote:
> Oops, I meant "other" as in "not monotone". With my example being "ls"
> (which I have the GNU coreutils version, on current Debian testing).

Oh, I see, that makes more sense, now. And yes, I agree, it's a good
idea to be consistent with other unix commands like ls, here.

>>> If --colorize is given explicitly, I'd think it should colorize
>>> regardless of what it thinks the output type is.
>> I see your point. And it seems that would be more consistent with how
>> '--ticker' works as well. I'll change that. Thanks for your input.

Changed and committed. Now, on a smart terminal, the following two are
equivalent:

    $ mtn diff
    $ mtn diff --colorize | less -FRX

>> The same argument could be applied for '--pager', though, where I have a
>> bit of a hard time coming up with a valid use case.
>
> Hm... --pager in general is a bit odd really, but maybe I'm just too
> comfortable with unix pipelines.

Well, it IS a unix pipe at work, there. ;-)

Admittedly, that feature is inspired by git. The first time git offered
me a pager, I was surprised. By now, I'm so used to it that appending "|
less" to many of the mtn commands started to itch. I scratched.

> --pager means, send the output thru this other program instead of to
> normal STDOUT. Which does not make sense if STDOUT is being captured,
> which can be approximated by STDOUT not being a smart terminal.

Correct.

> It also doesn't make much sense to give --pager explicitly,

Exactly.

> since piping
> to your paging program does the same thing and is more consistent with
> the rest of the world. Unless you're on Windows I guess?

I'm not. Nor does this feature work on Windows, sorry. (Neither
colorization nor piping to a pager, to be specific.)

> That's a use case. Have --pager be a GUI program (notepad, whatever),
> which doesn't output thru your terminal. In which case you probably want
> it *especially* if your terminal isn't smart.

Such a program would need to be able to read from stdin, but not write
to stdout. AFAIUI emacsclient, for example, cannot do that. Are you
aware of any such program?

In any case, I also changed --pager to always, unconditionally pipe
through a pager program.

(More importantly, I should now make that pager program configurable.)

Regards

Markus



_______________________________________________
Monotone-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/monotone-devel

signature.asc (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: colorization

Tim Brownawell
On 04/13/2015 03:02 AM, Markus Wanner wrote:
>> That's a use case. Have --pager be a GUI program (notepad, whatever),
>> which doesn't output thru your terminal. In which case you probably want
>> it *especially* if your terminal isn't smart.
> Such a program would need to be able to read from stdin, but not write
> to stdout. AFAIUI emacsclient, for example, cannot do that. Are you
> aware of any such program?

I stumbled across TortoiseUDiff (from Tortoise SVN) Friday, which can be
used this way.

On Linux gedit also works (given "-" as the filename), but not any of
the others I've tried yet.

_______________________________________________
Monotone-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/monotone-devel