On Tue, Aug 26, 2025 at 03:23:09PM -0500, G. Branden Robinson wrote:
At 2025-08-26T18:33:23+0100, Colin Watson wrote:
I could of course have man(1) unconditionally pass -rU0 to groff until
the problem is resolved properly, which would at least preserve
existing behaviour for users of unreleased groff 1.24.  I'm not sure
whether that would be considered as playing Core War with the manual
page system ...

A better stopgap measure can probably happen in "an.tmac" and "doc.tmac"
themselves.

groff has the `\V` escape sequence to interpolate an environment
variable's contents.  The packages could whitelist a set of `TERM`
terminal type names as commodious of OSC 8 hyperlinking.

Here's a sketch, interpolated into some existing logic.

.\" For most purposes, we treat the nroff devices equivalently.
.nr an*is-output-terminal 0
.if '\*(.T'ascii'  .nr an*is-output-terminal 1
.if '\*(.T'latin1' .nr an*is-output-terminal 1
.if '\*(.T'utf8'   .nr an*is-output-terminal 1
.
.nr an*can-hyperlink 0
.if \n[an*is-output-html] \
.  nr an*can-hyperlink 1
.
.if \n[an*is-output-terminal]) \{\
.  if '\?\V[TERM]\?'gnome-terminal'       .nr an*can-hyperlink 1
.  if '\?\V[TERM]\?'some-other-terminal'  .nr an*can-hyperlink 1
.  if '\?\V[TERM]\?'yet-another-terminal' .nr an*can-hyperlink 1
.\}

I don't think that works. When I start a gnome-terminal instance, I have TERM=xterm-256color. (See VTE_TERMINFO_NAME in https://gitlab.gnome.org/GNOME/vte/-/blob/master/src/vtedefines.hh.)

There are a couple of GNOME_TERMINAL_* environment variables set, but the source code says they're private variables used for internal communication. I suppose one could check for VTE_VERSION, and VTE is the component of gnome-terminal that actually implements OSC 8 anyway.

I'm not in love with this; I think it solves the wrong problem--a
terminal's _type name_ is not what determines whether it has a given
capability.  It's terminfo's (and the dead-but-unburied termcap's) job
to maintain knowledge of each terminal type's capability repertoire.

But for getting over a hump while the community sorts out its direction
on this matter, it's good enough.

I guess I might reluctantly agree. I do worry that it will just ossify a temporary hack, though, and potentially having to keep track of all the stuff in https://github.com/Alhadis/OSC8-Adoption seems pretty tedious; it might not even be possible to detect all of those via the environment.

--
Colin Watson (he/him)                              [cjwat...@debian.org]

Reply via email to