zsh-vi-mode icon indicating copy to clipboard operation
zsh-vi-mode copied to clipboard

ZVM conflicts with bracketed paste

Open ipkiss42 opened this issue 1 year ago • 0 comments

General information

  • Terminal program: WezTerm v20230408.112425 (xterm-256color)
  • Operating system: Amazon Linux 2 (5.10.184-153.749.amzn2int.x86_64)
  • ZSH framework: antidote (but I had the same issue with a manual installation of ZVM)
  • ZSH version: zsh 5.8.1 (x86_64-koji-linux-gnu)
  • ZVM version: zsh-vi-mode 0.10.0

Basic examination

  • [X] I have read through the README page
  • [X] I have the latest version of zsh-vi-mode
  • [ ] I have tested with another terminal program

Problem description

When bracketed paste is enabled in both zsh (this is the default behavior) and the terminal, pasting a oneliner in insert mode prints the clipboard text (as expected), but also switches to normal mode and flips the case of the character before the cursor (and all the ones after it, if the cursor was not at the end of the line).

This does not happen without bracketed paste. This also doesn't happen without ZVM.

It looks like the \e[201~ sequence at the end of the bracketed paste is intercepted by ZVM, which interprets it as user input. Indeed, after one undo the original text is restored. But of course it is annoying to undo and go back to insert mode every time I paste something...

Reproduction steps

  1. Use a terminal supporting bracketed paste, such as WezTerm
  2. Enable bracketed paste in the shell, if not already on
  3. Place some simple one-liner text in your clipboard, e.g. Hello World
  4. Paste the text in zsh, in insert mode
  5. Observe that the text has become Hello WorlD and that you are in normal mode
  6. Disable bracketed paste, e.g. with unset zle_bracketed_paste. Or disable ZVM instead
  7. Paste the text again
  8. Observe that the text is pasted correctly

Expected behavior

ZVM is "bracketed paste aware" and handles the special sequences gracefully.

ipkiss42 avatar Aug 06 '23 05:08 ipkiss42