[darcs-users] Re: Pipes, pagers and pretty colors

Michael G Schwern schwern at pobox.com
Sat Apr 2 23:06:20 UTC 2005


On Sat, Apr 02, 2005 at 03:08:50PM +0000, Mark Stosberg wrote:
> On 2005-04-02, Michael G Schwern <schwern at pobox.com> wrote:
> >
> > A)  Have darcs invoke $PAGER itself when output is to a TTY.
> 
> I support this, with the following additional idea:
> 
> With 'less' being widely pre-installed and a popular paging choice, I
> think it's worth special casing. darcs can check to see if 'PAGER' is
> less with an appropriately recent version to display color codes, and then
> turn add "-R" if so. 
> 
> Or perhaps people should simply be encouraged to set PAGER="less -R" if
> they want that? 

I would shy away from this sort of second guessing the user.  

Their terminal might not be able to display ANSI color and the escape codes
screw things up.  The escape codes might screw up their version of less.
They might be working on files with escape codes in them.  Their less
might be an alias to some other pager (I've seen it done the other way
around).  They might have already tweaked their less flags and don't
want you screwing with them.

-R also has some consequences.  It degrades less' ability to track the
screen state which can cause weird display behavior.

       -R or --RAW-CONTROL-CHARS
              Like  -r, but tries to keep track of the screen appearance where
              possible.  This works only if the input consists of normal  text
              and  possibly  some  ANSI  "color"  escape  sequences, which are
              sequences of the form:

                   ESC [ ... m

              where the "..." is zero or more characters other than "m".

PS less already has an environment variable for setting switches... LESS.


> > B)  Use bold and underline instead of colors for emphesis.
> 
> Want about using bold/underline and colors? 

To sum up the argument against colors...

* Some people are color blind
* Many terminals can't handle ANSI color
* Even if they can its hard to detect if they can
* Many pagers can't handle ANSI color even with special flags
* Even if they can its hard to detect if they can
* What value is it adding above and beyond bold and underline?

So it boils down to this:  color is a pain in the ass to get right and is 
it really adding anything over bold and underline?

If you really want color maybe there can be a global --color switch which
all commands respect and which can be turned on in your .darcs file.  But
for a default, bold and underline seem to have the best and safest bang for 
the buck.





More information about the darcs-users mailing list