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
definitions).
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.
E.g.
%(termcolor red)red text on default background%(termcolor default)back to
defaults
and
%(termcolor white/red)white text on red background%(termcolor default)regular
text
This makes it much more obvious what's going on, and simplifies keeping track
of the 'visible characters' column counter.
--lyndon
_______________________________________________
Nmh-workers mailing list
Nmh-workers(_at_)nongnu(_dot_)org
https://lists.nongnu.org/mailman/listinfo/nmh-workers