[BRLTTY] Preserving presentation when copying to the clipboard

Aura Kelloniemi kaura.dev at sange.fi
Mon Mar 31 15:11:10 UTC 2025


Hi,

On 2025-03-30 at 17:22 -0400, Dave Mielke <Dave at mielke.cc> wrote:
 > [quoted lines by Aura Kelloniemi on 2025/03/30 at 21:07 +0300]

 > >2) Bracketd paste. I don't know if this is feasible or not. At least Linux
 > >terminal does not support it, but tmux and many applications nowadays do.

 > Brltty monitors what's on the screen. It's totally unaware of whatever
 > escape sequences might've been sent to the terminal to produce that content

This is of course correct. We might add that BRLTTY is also completely unaware
 of what the application (that happens to be reading from the terminal) is
 going to do with the input, if anything.

Yet this unawareness does not prevent BRLTTY from sending pasted text or
cursor routing key sequences to the terminal. BRLTTYcompletely disregards that

1) The receiving application does not necessarily react to the sent data in
 any desirable way,

2) BRLTTY does not even know the terminal type, so when sending cursor key
 escape sequences, it might well send wrong escape sequences for the terminal.

Often confusion, and even data loss has happened due to BRLTTY's behaviour.
One of my NetHack characters died because I accidentally pressed a
cursor routing button during gameplay. Isn't that serious?

But in practice, we find BRLTTY's cursor routing and clipboard functionality
so useful, that we tolerate these shortcomings. And this leads to:

 > so bracketed paste can't be supported.

The question is about at what cost. BRLTTY could have a toggle for controlling
sending the bracketed paste sequence to the terminal. Or BRLTTY could have a
separate PASTE_BRACKETED command. When bracketing is enabled, BRLTTY would
bracket the pasted text with the escape sequences used by Xterm (and by the
way all other terminal emulators which support this feature). This, of course,
might break if used in a wrong context, but this is in no way different from
the current situation where the user might paste text in a wrong context.

Would this be beginner friendly? No, it wouldn't. But equally the current
behaviour of pasting and cursor routing are not beginner-friendly, especially
not for users not used to how text terminals work.

Would this be worth testing? I believe so. I believe that implementing this
would be kind of a small effort, and removing it (if the feature finds no
users) is even easier. Also, this would not affect those people, who do not
ever enable the toggle for bracketed paste.

-- 
Aura


More information about the BRLTTY mailing list