Pasting specific texts into vim (WSL) breaks some keys #21186

Open
opened 2026-01-31 07:35:48 +00:00 by claunia · 0 comments
Owner

Originally created by @csdivad on GitHub (Feb 2, 2024).

Windows Terminal version

1.20.10303.0 and 1.19.10302.0

Windows build number

10.0.22621.0

Other Software

vim 9.1.31 in WSL
nvim v0.9.5 in WSL

Steps to reproduce

  1. Open vim in WSL using Terminal 1.20.10303.0 or 1.19.10302.0. Version 1.18.10301.0 is unaffected.
  2. Enter insert mode by pressing i.
  3. Paste in the following text with right click or shift+insert: 37616af9da/test.txt

This input is a base64 encoded chunk of Lorem Ipsum.
The issue only happens with specific inputs. I encountered it first when pasting another base64 encoded text, but that had sensitive data in it.
Then I played around with dd if=lorem.txt bs=1 count=... | base64 -w 180 until I found a configuration that also triggered the issue.

Expected Behavior

Escape, backspace and Function keys works properly after the paste.
Only the pasted text appears in the editor.

Actual Behavior

You are now stuck in editing mode. Esc, backspace and other keys are now sending weird escape sequences.
After the last character a 1~ appears. Pressing esc inserts ^[, pressing backspace inserts ^?.

Originally created by @csdivad on GitHub (Feb 2, 2024). ### Windows Terminal version 1.20.10303.0 and 1.19.10302.0 ### Windows build number 10.0.22621.0 ### Other Software vim 9.1.31 in WSL nvim v0.9.5 in WSL ### Steps to reproduce 1. Open vim in WSL using Terminal 1.20.10303.0 or 1.19.10302.0. **Version 1.18.10301.0 is unaffected.** 2. Enter insert mode by pressing i. 3. Paste in the following text with right click or shift+insert: https://gist.githubusercontent.com/csdivad/8c1069a35b52fb806ee8e4484b38f1f3/raw/37616af9daee626df6e7065059de5d5d87d8c9ec/test.txt This input is a base64 encoded chunk of Lorem Ipsum. The issue only happens with specific inputs. I encountered it first when pasting another base64 encoded text, but that had sensitive data in it. Then I played around with `dd if=lorem.txt bs=1 count=... | base64 -w 180` until I found a configuration that also triggered the issue. ### Expected Behavior Escape, backspace and Function keys works properly after the paste. Only the pasted text appears in the editor. ### Actual Behavior You are now stuck in editing mode. Esc, backspace and other keys are now sending weird escape sequences. After the last character a `1~` appears. Pressing esc inserts `^[`, pressing backspace inserts `^?`.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#21186