groff
[Top][All Lists]
Advanced

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

Re: [Groff] preserve ascii escape characters from input


From: Ralph Corderoy
Subject: Re: [Groff] preserve ascii escape characters from input
Date: Sat, 27 Feb 2010 16:50:41 +0000

Hi Leonardo,

> At Thu, 25 Feb 2010 22:45:51 +0000, Keith Marshall wrote:
> > if you emit ANSI sequences to a native MS-Windows console, they will
> > display as mostly incomprehensible hieroglyphics.
> 
> Right, but is it possible to solve that with terminfo or tput?

Yes.  That's exactly what termcap, terminfo, tput, etc., were created
for.  You don't emit ANSI.  The program uses a device-independent
approach and $TERM is used to find the device-dependent bytes to send,
which may be ANSI sometimes.

> Let me rephrase the question.  Suppose I make `ls --color` use
> terminfo, instead of hardcoded ANSI escapes.

As my other email made clear, ls only defaults to ANSI escapes but
defining LS_COLORS means non-ANSI can be used.

> Are there any previously-unsupported terminals that could now display
> colors?  (It's not a rethoric question, I'm genuinely curious.)

Lots.  Note how all of these terminal definitions on this Ubuntu system
use a different escape sequence to set the foreground colour to 4.
There are others, this was a random selection after a quick grep.

    $ for f in xterm ctrm d220-dg hft-c wy350 wy370 gs6300 qnx; do
    >     TERM=$f tput setf 4 | hd;
    > done
    00000000  1b 5b 33 31 6d                       |.[31m|
    00000005
    00000000  1b 26 62 6e 1b 26 62 52              |.&bn.&bR|
    00000008
    00000000  1e 41 34                             |.A4|
    00000003
    00000000  1b 5b 33 34 6d                       |.[34m|
    00000005
    00000000  1b 47 34                             |.G4|
    00000003
    00000000  1b 5b 36 31 3b 34 77                 |.[61;4w|
    00000007
    00000000  1b 5b 3f 33 6d                       |.[?3m|
    00000005
    00000000  1b 40 34 30                          |address@hidden|
    00000004
    $ 

Cheers,
Ralph.





reply via email to

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