groff
[Top][All Lists]
Advanced

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

Re: [BUG] italics run past where they should


From: G. Branden Robinson
Subject: Re: [BUG] italics run past where they should
Date: Mon, 15 Aug 2022 20:59:25 -0500

Hi Alex,

At 2022-08-15T22:53:42+0200, Alejandro Colomar wrote:
> On 7/21/22 18:46, G. Branden Robinson wrote:
[...]
> > I have a more precise hypothesis.
> > 
> > You have obviously observed that these pagers highlight the match.
> > This is often done by selecting the terminal's "standout" mode (this
> > is an ECMA-48 term).  It is defined as the most prominent form of
> > styling available.  This mode often combines with other styles (or
> > "renditions") like bold, italics, or underlining.  Inverse video
> > (ECMA-48: "negative image") is common and widely supported, possibly
> > because it was cheap to implement in hardware on monochrome
> > terminals back in the day.
> > 
> > ECMA-48 also has a sequence that shuts off all special renditions.
> > This is called "SGR 0".  It is so commonly used that there is a
> > dedicated terminfo capability for it, called "sgr0".  When the
> > terminal gets attributes "stuck on", as when a TUI program exits
> > without properly resetting the terminal state, a straightforward
> > command cleans up the colors, highlighting and whatnot.
> > 
> > $ tput sgr0
> > 
> > (TUI programs that exit abnormally often leave other terminal
> > attributes screwed up too, like leaving the cursor invisible or
> > leaving the TTY in the wrong mode, like "raw" instead of "cbreak".)
> > 
> > So I suspect what is happening is that these pagers are blindly
> > emitting an SGR 0 escape sequence at the end of the match.  As
> > you're seeing, this is wrong because attributes may already have
> > been put in place prior to the beginning of the match boundary, and
> > they need to be restored.
[...]
> > If you can persuade the pager to dump its output to a file without
> > noticing that it's not a TTY and thereby changing its behavior, you
> > can inspect the escape sequences it emits.  I did this when testing
> > the implementation of grotty's OSC 8 support several months ago but
> > I don't remember the trick I used.
[...]
> 
> I'm just pinging about old stuff.
> 
> If you could please revisit this, it would be nice.

I didn't realize you were waiting on me--sorry.  It would be good if you
could collect the pager output _including terminal escape sequences_,
for instance using the script(1) command (as Ralph pointed out).  Attach
it to your email.  It should then be possible to see which sequences are
being sent, and then either confirm or overturn my hypothesis.

Regards,
Branden

Attachment: signature.asc
Description: PGP signature


reply via email to

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