[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Nmh-workers] colorized/highlighted scan output?

From: Lyndon Nerenberg
Subject: Re: [Nmh-workers] colorized/highlighted scan output?
Date: Sat, 3 Nov 2012 16:14:22 -0700

On 2012-11-03, at 6:16 AM, Ralph Corderoy wrote:

> There is dircolors(1) to help set LS_COLORS for ls(1) to read, e.g.
> `dircolors --print-database', but I agree with disliking hard-coding
> ANSI escape sequences.

Hardcoding is silly ;-)

You can get the sequences out of terminfo without having to use the full blown 
curses interface. (tparm() if memory serves).  And by using terminfo, you make 
this work with more than just xterm. You also make it possible for the end user 
to customize the behaviour (through custom terminfo files and their own $TERM 

Then, instead of dealing with the whole 'hardcoded variable invisible strings 
into the buffer' mess, define a function that emits the escape sequence 
appropriate to the colour you want.


  %(termcolor red)red text on default background%(termcolor default)back to 


  %(termcolor white/red)white text on red background%(termcolor default)regular 

This makes it much more obvious what's going on, and simplifies keeping track 
of the 'visible characters' column counter.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]