-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
Open
Labels
clipboardclipboard, pasteclipboard, pastehas:planinputtuitermcodes, terminfo, termcaptermcodes, terminfo, termcap
Milestone
Description
Since #4448 , paste is handled now by the vim.paste() handler (which is invoked by the UI via nvim_paste()).
There is a potential issue where the TUI could get stuck in paste-mode if the host terminal fails to send a stop-paste sequence (<Esc>[201~). In this state, the user could recover by RPC:
nvim_paste([''], 3)
Nvim GUIs using nvim_paste do not need such workarounds because they use an out-of-band channel (as opposed to the TUI where user input + paste are in-band).
Vim fixed a similar issue with its bracketed-paste implementation, but:
- the "infinite loop" problem does not apply because Nvim doesn't actively loop
- CTRL-C would not interrupt the paste in Nvim, so a "dangling paste" is less likely. (Could be caused by network failure instead.)
- But CTRL-C would be useful for recovering from this "stuck in paste" state.
- Related: <ctrl-c> not stopping text paste #13031 (comment)
Plan
- TUI needs to check
nvim_paste()result (e.g. revert 2c605d1 ) vim.paste()Lua handler could track some state to decide if a paste is "stuck". E.g. if the paste stream is very "slow", and CTRL-C is seen ~twice in a row, we can guess that (1) the paste was exhausted and (2) the user is trying to cancel the operation, thusfalseshould be returned.
mengq627e-kwsm
Metadata
Metadata
Assignees
Labels
clipboardclipboard, pasteclipboard, pastehas:planinputtuitermcodes, terminfo, termcaptermcodes, terminfo, termcap