[BRLTTY] Preserving presentation when copying to the clipboard
Aura Kelloniemi
kaura.dev at sange.fi
Tue Apr 1 10:13:19 UTC 2025
Hi,
On 2025-03-31 at 13:29 -0400, Dave Mielke <Dave at mielke.cc> wrote:
> [quoted lines by Aura Kelloniemi on 2025/03/31 at 18:11 +0300]
> >Yet this unawareness does not prevent BRLTTY from sending pasted text or
> >cursor routing key sequences to the terminal.
> Those are two different things. Sending pasted text is fine as that's
> exactly what the user is wanting. Sending cursor keys, on the other hand,
> assumes that they'll be recognized for what they are. Since we know tht
> we're writing to a Linux console, though, and since, for a Linux console,
> those sequences are well-defined, it, too, isn't a problem.
But we don't know whether the receiving application understands those
sequences. Some examples of applications which do not understand them are cat
and TTY version of NetHack. For example NetHack takes the initial escape as a
command to close the current window or to reject the current prompt and then
interprets the remaining characters as commands. I have tried to get a fix to
NetHack, but they refuse because of portability reasons.
Some modern Go and Haskell applications also fail with BRLTTY's cursor
routing. Because BRLTTY inserts characters very fast and because these
applications read input with too small buffer size, it often happens that the
buffer gets full in the middle of an escape sequence. The result is that the
application misinterprets partial cursor routing key sequences as regular input.
Some applications do completely unexpected things when cursor keys are fed to
them. Try for example pressing the left arrow in the Lynx browser. Even though
injecting left/right to Lynx can be a fatal mistake in the middle of filling a
long web form, BRLTTY still does it, if the user requests cursor routing in a
wrong place.
This is not to say that we shoudl try to fix this. We can't. This is to say
that we could add (optional, off by default) support for bracketed paste,
because it is not any worse footgun than the already existing ones.
--
Aura
More information about the BRLTTY
mailing list