Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 Oct 2002 00:14:42 -0700
From:      Terry Lambert <tlambert2@mindspring.com>
To:        Ruslan Ermilov <ru@FreeBSD.ORG>
Cc:        "Andrey A. Chernov" <ache@nagual.pp.ru>, "M. Warner Losh" <imp@bsdimp.com>, arch@FreeBSD.ORG
Subject:   Re: color, again, in grotty
Message-ID:  <3DB3A962.9F26FCA0@mindspring.com>
References:  <20021017.101833.110719994.imp@bsdimp.com> <20021018095026.GA3386@sunbay.com> <20021018.094801.123456703.imp@bsdimp.com> <3DB06A8B.E40B3004@mindspring.com> <20021018201919.GA15100@nagual.pp.ru> <20021021065156.GB14584@sunbay.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Ruslan Ermilov wrote:
> > > > : So we must either fix syscons(4) or to somehow tell grotty(1) to
> > > > : emit old sequences to print bold and italic characters.
> > >
> > > Fixing Grotty to use the termcap ("TermCap" -- Terminal Capabilities)
> > > database is the correct approach, in almost all cases.
> >
> > I agree. Grotty should get termcap color capabilities using TERM env.
> > variable, if output isatty(). That is termcap purpose.
> 
> It is almost never isatty(), because the most typical scenario is
> to pass the output through a pipe to ${PAGER}, or to a compressor.

Pagers can't tell the difference between an escape sequence that
results in characters which are not displayable without the
escape sequence (and therefore take a character cell on the screen)
and those which manipulate display attributes (and therefore do not
take any screen space) from those which do cursor positioning in
place of "CR/LF" (e.g. "delete line" at the top of the page is
equivalent to scrolling) vs. those which do nothing apparent.

Therefore, it's unreasonable to run processed data through a
pager, if the results of that processing include terminal
implementation dependent escape sequences..

The way this is normally dealt with is to use "_^HX" for underscore,
"X^HX" for bold, etc., utilizing "overstrike", and have the pager
convert it based on the pager's knowledge of the terminal display
sequences from the termcap.

Note that, so long as ASCII <BS> (0x08) is backspace, and moves
the cursor one to the left, in the absence of additional terminal
interpretation, the resulting data will be displayed as readable
text, minus the attributes (e.g. even if the second character
replaces, rather than overstriking the first, the text will end
up being the same, without any display attributes at all).


I guess a lot of kids these days have grown up without having to
use real tty or terminal hardware, so they don't understand all
the work that has already gone into finding the correct way to
deal with these issues...

-- Terry

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3DB3A962.9F26FCA0>