Quoth Lennart Jablonka:
I wanna tell you: When manually testing, I found MR man page references followed by space to be followed by a backslash preceding the space and I found no OSC 8 emitted. Or similar.

I’ll debug that later. While I know tty.cpp fairly well now, I have to admit the OSC 8 stuff, I haven’t looked at very much yet.

It wasn’t the OSC 8 stuff.

To make it work with the bug:

        $ cat tmux-os
        tmux-os|tmux that overstrikes,
                os,
                use=tmux,
        $ export TERMINFO=`pwd`/ti
        $ tic tmux-os
        $ g=~/src/groff
        $ $g/groff -Z -F $g/font -M $g/tmac -T utf8 -man $g/man/groff.7 |
        > TERM=tmux-os $g/grotty -F $g/font | less -r

What happens is:

On a hardcopy terminal, printing \zO+ might produce something like (an ugly version of) ⊕: a circle with a plus inside. We do that by overstriking the glyphs. The output would be O ^H +.

With my patch, we do overstriking only if the terminal description declares that possible using the capability os. Your local terminal emulator neither renders overstruck glyphs nor has os in its terminal description. Thus, we don’t overstrike.

Whenever grotty (tty_printer::end_page, tty.c:/'if (nextp && p->hpos == nextp->hpos) {') notices two adjacent glyphs with the same position, it assumes they are to be overstruck—if we have that enabled. If the terminal supports it.

OSC 8 sequences are, unlike terminfo capabilities, put into the stream of glyphs to be set. Instead of end_page printing the sequences whenever it thinks that it’d be a good moment to create a link, it knows not about such links and sees the sequences passing by in the stream of glyphs.

The bytes composing the escape sequence aren’t supposed to be visible to the eye staring at the page. So, they have a width of zero.

And as such it happens: The end_page function sees the escape sequences as series of zero-width glyphs, each at the same position. Knowing that overstriking glyphs wouldn’t have any effect, it ignores all but the last glyph at the same position. That last glyph happens to be the first of the link’s text and either a glyph following the link, such as punctuation, or the backslash concluding the link as part of ST.

The fix might be to take OSC 8 sequences out of the glyph stream. It should be handled similar to other capabilities. Either special glyphs are introduced that tell end_page to emit OSC 8 sequences, or each glyph gets an optional URI attribute.

Reply via email to