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: Tue, 16 Aug 2022 07:40:14 -0500

Hi Alex,

At 2022-08-16T13:57:00+0200, Alejandro Colomar wrote:
> On 8/16/22 03:59, G. Branden Robinson wrote:
> > 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.
> 
> Sure.  It is attached.  To reproduce it:
> 
[ $ script ]
> $ man membarrier
> /cmd[ENTER]
> q
> $ ^D

I'm sorry to say I just can't reproduce what you are seeing.  I used
several combinations of pager and terminal emulator.

XTerm(370)
# GNOME Terminal 3.38.3 using VTE 0.66.1 +BIDI +GNUTLS +ICU +SYSTEMD
more from util-linux 2.36.1
less 581.2 (POSIX regular expressions)
less 551 (GNU regular expressions)

(Using "more" was pointless since it doesn't highlight search matches
anyway.)

Here's the relevant synopsis line indicating the terminal control
sequences present.  This is from my typescript.

       ESC[1mint membarrier(int ESC[4mESC[22mcmdESC[24mESC[1m, unsigned

When I do the search (with gnome-terminal and less 551), it changes to
this.

ESC[10;1H       ESC[1mint membarrier(int 
ESC[4mESC[22mESC[7mcmdESC[27mESC[24mESC[1m, unsigned

So let's decode these sequences.  The key to interpreting ISO 6429
escape sequences is, once you see ESC [ (the "control sequence
introducer"), skip ahead to the last character before proper terminal
contents.  In the first exhibit, that's an "m" every time.

We can then look up the meanings in the xterm ctlseqs.ms document.

https://invisible-island.net/xterm/ctlseqs/ctlseqs.html

We see that CSI sequences ending in "m" are "character attributes",
exactly what we expect.  These are all pretty simply, there's only one
parameter given to each.  They are 1, 4, 22, 24, and 1 again.

Per the document, we have:

1       bold
4       underlined
22      normal (weight, i.e., not "bold" or "faint")
24      not underlined

(Typographers would say "light" rather than "faint", but on the other
hand the underlying subject is a standard for _video_ terminals.)

Seems reasonable: all we've got in that synopsis line is bold and
"italics".  The shift to normal is expected since "cmd" is not supposed
to be both bold _and_ underlined.

Okay, now let's consider the post-search output.

We have a new sequence, one ending in "H".  We can guess its function
since every line after the search looks like this, with a highly
suggestive parameter pattern.  Nevertheless we'll go to the document.

"H" is the sequence for cursor positioning.  We can see that

  ESC [ 10 ; 1 H

means to move the cursor to the 10th row, 1st character.  (Character
cell addresses in ISO 6429 are 1-based, not 0-based.)

(For you, it's line 14 since I'm reading the membarrier(2) man page on
my Debian-based system, not your bleeding edge version with the
"LIBRARY" section heading near the top of the page.)

We can disregard this.  less(1) has simply redrawn the screen line by
line rather than scrolling it or using some other technique.  (If a
pager were written to use curses, we might see "optimized" screen
updates that only redrew the character cells that needed to change.  But
let's be glad of the waste, because it makes the typescript _much_
easier to interpret.)

So what remains?  We see the four familiar from before plus two new
ones.

7       inverse
27      positive (i.e., not inverse)

Furthermore the use of these two escape sequences precisely brackets
"cmd", the search pattern.

I have to say I just don't see a problem here.  I think it is time to
consider the possibility of a bug in the terminal emulator you're using.
Which one is it?  Try different ones.

Regards,
Branden

Attachment: signature.asc
Description: PGP signature


reply via email to

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