feat(window): confirm multi-line pastes#85
Open
roramirez wants to merge 1 commit into
Open
Conversation
Add window.paste_confirm_lines (default 0 = off). When set to N > 0, pasting clipboard text whose newline count is >= N first shows a modal confirmation overlay instead of writing to the PTY. Both the keyboard paste and middle-click paste paths route through a shared paste_text helper; the raw text is stashed and re-encoded on confirm so the pane's bracketed-paste state is read at send time.
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
Adds
window.paste_confirm_lines(default0= disabled) to guard against accidentally executing pasted multi-line content. When set toN > 0, pasting clipboard text whose newline count is>= Nshows a modal confirmation overlay ([y]Paste,[n]/EscCancel) instead of writing to the PTY. With the default0, behavior is unchanged.Changes
window.paste_confirm_lines: usize(serde default0) inWindowConfig, plusassets/config.tomland the in-app config TUI (newF_PASTE_CONFIRMfield,build_configread).AppState.pending_paste: Option<String>holds the raw clipboard text awaiting confirmation.do_pasteanddo_middle_click_paste) now delegate to a sharedApp::paste_text, which gates multi-line pastes; the raw text is re-encoded on confirm so the pane's bracketed-paste state is read at send time (middle-click keeps its always-bracketed semantics on immediate send).try_dispatch_overlay_keyhandles the confirm/cancel keys (checked before mode dispatch);draw_paste_confirmrenders the dialog over the dimmed buffer.doc/SPEC.mdconfig table + prose,README.md[window]block,CHANGELOG.md.How to test
cargo test— 1217 tests pass (8 new).cargo clippy --locked -- -D warnings— clean.paste_confirm_lines = 2inconfig.toml, copy a 3-line block, paste (Ctrl+Shift+V or middle-click). The confirmation overlay appears;ypastes,n/Esccancels. Withpaste_confirm_lines = 0, pastes go through unchanged.