Repository navigation
feat: add Alt+V paste support for Windows Terminal - #2018
LittleDrinks wants to merge 1 commit into
Conversation
Windows Terminal intercepts Ctrl+V for its own text paste, so prompt_toolkit never receives the event. Alt+V (escape, v) is bound as a fallback with identical media paste logic.
There was a problem hiding this comment.
Pull request overview
Adds an alternative paste shortcut to work around Windows Terminal intercepting Ctrl+V, ensuring clipboard/media paste remains accessible via Alt+V.
Changes:
- Update toolbar tips to advertise
ctrl-v/alt-vfor clipboard paste. - Add an
Alt+V(escape,v) key binding that mirrors the existingCtrl+Vpaste behavior and telemetry.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| ] | ||
| if clipboard_available: | ||
| tips.append("ctrl-v: paste clipboard") | ||
| tips.append("ctrl-v/alt-v: paste clipboard") |
There was a problem hiding this comment.
This tip text change will break the existing unit test that asserts the exact clipboard tooltip string (tests/ui_and_conv/test_prompt_tips.py::test_build_toolbar_tips_with_clipboard currently expects "ctrl-v: paste clipboard"). Update the test expectation (or adjust the tip formatting to preserve the old text) so CI stays green.
| tips.append("ctrl-v/alt-v: paste clipboard") | |
| tips.append("ctrl-v: paste clipboard") |
| @_kb.add("escape", "v", eager=True) | ||
| def _(event: KeyPressEvent) -> None: | ||
| from kimi_cli.telemetry import track | ||
|
|
||
| track("shortcut_paste_alt") | ||
| if self._try_paste_media(event): | ||
| return | ||
| clipboard_data = event.app.clipboard.get_data() | ||
| if clipboard_data is None: # type: ignore[reportUnnecessaryComparison] | ||
| return | ||
| self._insert_pasted_text(event.current_buffer, clipboard_data.text) | ||
| event.app.invalidate() |
There was a problem hiding this comment.
The Alt+V handler duplicates the Ctrl+V paste logic line-for-line, which makes future changes to paste behavior easy to miss in one of the two bindings. Consider sharing a single handler (e.g., stack two @_kb.add decorators on one function, or call a small shared helper) and pass a property/parameter to telemetry to distinguish ctrl vs alt if needed.
Windows Terminal intercepts Ctrl+V for its own text paste, so prompt_toolkit never receives the event. This PR adds Alt+V as a fallback key binding with identical media paste logic.