feat(input): smart Ctrl+C — copy selection or send SIGINT#78
Open
roramirez wants to merge 1 commit into
Open
Conversation
Ctrl+C previously mapped to Action::Copy for any Visual mode, including un-anchored navigation where do_visual_copy no-ops, swallowing the key. Now Ctrl+C copies only when there is a real (anchored) selection and sends SIGINT (0x03) in every other case (Insert, Normal, un-anchored Visual).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Ctrl+C now copies only when there is a real (anchored) selection; in every other case it sends SIGINT (0x03) to the PTY. Previously Ctrl+C mapped to
Action::Copyfor any Visual mode — including un-anchored navigation, wheredo_visual_copyno-ops — so the keypress was silently swallowed instead of interrupting the running program.Changes
src/input/keybindings.rs: extractctrl_c_action(mode)— returnsAction::Copyonly forInputMode::Visual { anchored: true, .. }, otherwiseAction::SendToPty(vec![3])(SIGINT). Wired intohandle_ctrl_only.src/input/keybindings_test.rs: cover Ctrl+C in Insert, Normal, anchored Visual (copy), un-anchored Visual (SIGINT, not no-op), and Ctrl+Shift+C / Ctrl+Alt+C (no regression to Copy).CHANGELOG.md,doc/SPEC.md,README.md: document the new Ctrl+C behavior.How to test
cargo test— all tests pass (1221 passed).v, press Ctrl+C and confirm it copies to the clipboard and returns to Insert.