Fix delay of sending bracketed-paste-end sequence #2341
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem (reported by @itchyny)
On
:terminalon terminal-application with support for bracketed-paste, paste (e.g. Cmd-V on macOS) may not work properly.Repro steps
The case of zsh:
vim --clean +'term zsh'and paste text "echo hello", then an extra character
~is appended.Detail
When user pastes "echo hello", Vim receives
\e[200~echo hello\e[201~and trys to send it to:terminal, but the end sequence\e[201~is separated from the body of paste-text and then zsh will interpret it as mere~character.expected:
actual:
in <<means "Vim sends to:term zsh", andout>>means the echoback from tty.Cause
terminal.c:861
term_convert_key()When there is an input of bracketed-paste sequence
\e[200~or\e[201~, it is stored to vtrem buffer and is not sent at this time; then it will be sent to tty together with next input.Therefore the end sequence
\e[201~is not sent at the time of doing paste.