Bracketed Paste #305
Labels
No Label
bug
doc
duplicate
easy
enhancement
help wanted
invalid
not-a-bug
performance
question
refactor
regression
upstream
what do you think?
wiki
wontfix
No Milestone
No Assignees
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: dnkl/foot#305
Loading…
Reference in New Issue
There is no content yet.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may exist for a short time before cleaning up, in most cases it CANNOT be undone. Continue?
Can foot support bracketed paste? Or did I miss this option somewhere?
Foot does support it. There are no options related to it (like disabling it permanently).
How/where is it not working?
Multi-line paste is broken on an irc client, while libvte and kitty work correctly.
Foot automatically pastes each line individually, while the other terminals do not automatically paste anything.
Not working at all, or messing up the multi-line part?
http://thejh.net/misc/website-terminal-copy-paste
Not sure if this is related, but foot fails the second test.
That doesn't sound like the same issue. Foot fails to filter out the "bracketed paste" end sequence. I.e. the second test explicitly disables bracketed paste before doing its evil stuff.
Your issue probably has to do with line endings.
@JorwLNKwpH can you test #307?
I think it fixes your issue, but I'm not sure, since I haven't been able to reproduce it in any application.
The issue here is caused by foot not sending BRACKETED_PASTE terminal mode to notify the application.
I didn't see this until now. I think there's some confusion about what bracketed paste really is.
It is not about the terminal preventing, or requiring confirmation before pasting multiline text. Nor is it required to filter out any characters.
When bracketed paste is enabled, the terminal will wrap all pasted text in
\E[200~ TEXT TEXT \E[201~
. This allows the application to differentiate between typed text, and pasted text.This means there's actually no reason to ask for confirmation before pasting multiline text when bracketed paste mode has been enabled, since the application is expected to be able to deal with it by itself. That's the whole point with bracketed paste mode.
Zsh, for example, supports and enables bracketed paste. This is why, when I paste
it doesn't execute the above, as can be seen in the screenshot.
To enable bracketed paste mode, the application must send
\E[?2004h
to the terminal.Is this missing from the foot terminfo by any chance? Because launching the application with
TERM=xterm-256color
on foot doesn't seem to run into this issue (also alacritty seems broken as well in case that's relevant).There's no terminfo capability for enabling bracketed paste, although it's possible that your shell only sends
\E[?2004h
when$TERM
matches some known value.What shell are you using?
I'm using fish; I'll try some other shells and report back.
Update: Using foot with foot terminfo on dash or bash does not change anything.
Note that kitty works with kitty terminfo on fish. It could be that the application only detects bracketed paste for certain
TERM
s.@JorwLNKwpH remember that the shell will turn off bracketed paste before starting an application. Applications need to enable bracketed paste themselves.
And yes, some applications have the bad habit of checking the name of the terminfo (typically looking for the substring
xterm
, which is why kitty's terminfo is namedxterm-kitty
).Is the sources of this IRC client available for browsing somewhere? Should be pretty easy to see if/how/when it enables bracketed paste.
Note: I don't see why one would bother checking terminfo at all before enabling bracketed paste.
All terminals should ignore the
\E[?2004h
sequence if they don't support it.And to the application there's no difference between having tried to enabled bracketed paste, and not enabling it at all. Hence it's better to just try to enable it on all terminals. If it works it works.
FWIW, fish does enable bracketed paste in foot with
TERM=foot
.Thanks for the insight. I checked the source code, and it does appear (afaict) to be using terminfo-based checking with xterm as a special case :(
Closing this since the other bracketed/non-bracketed paste issues can be tracked elsewhere.
vty bundles "bracketed paste mode" with other XTerm extensions that aren't available as terminfo capabilities:
https://github.com/jtdaugherty/vty/issues/100#issuecomment-228617507
craigbarnes referenced this issue2021-01-31 12:33:23 +00:00