feat(tui): allow releasing mouse capture for native selection - #570
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1a1bf6c54e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| app.input = if app.mouse_capture { | ||
| "/mouse off".into() | ||
| } else { | ||
| "/mouse on".into() | ||
| }; |
There was a problem hiding this comment.
Preserve the composer draft when toggling mouse capture
When the composer contains an unsent draft, pressing Ctrl+Shift+M replaces the entire draft with /mouse on or /mouse off, and the subsequent submit() clears it, leaving no way to recover the user's text. Toggle the capture state through a helper that does not mutate app.input, or save and restore the input and cursor around the command.
Useful? React with 👍 / 👎.
| (m, KeyCode::Char('m') | KeyCode::Char('M')) | ||
| if m.contains(KeyModifiers::CONTROL) && m.contains(KeyModifiers::SHIFT) => |
There was a problem hiding this comment.
Choose a shortcut that works without keyboard enhancement
On terminals where caps.kitty_keyboard_safe is false—including the explicitly denylisted VS Code, Cursor, Windsurf, and Zed hosts—the run loop never enables key disambiguation. Under conventional terminal encoding Ctrl+Shift+M collapses to carriage return/Enter, so this match cannot fire and pressing the advertised toggle may submit the current composer instead. Gate the shortcut on the capability and avoid advertising it there, or use a chord distinguishable by legacy terminals.
Useful? React with 👍 / 👎.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1a1bf6c54e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| app.input = if app.mouse_capture { | ||
| "/mouse off".into() | ||
| } else { | ||
| "/mouse on".into() | ||
| }; |
There was a problem hiding this comment.
Preserve the composer draft when toggling capture
When Ctrl+Shift+M is pressed while the composer contains a draft, this assignment replaces the entire draft with /mouse on or /mouse off, and the subsequent app.submit() clears it. The user's unsent prompt is therefore silently and irrecoverably lost; toggle mouse_capture directly or preserve and restore the composer input, cursor, and history state.
Useful? React with 👍 / 👎.
EnableMouseCapture was unconditional for the whole session, so terminal native click-drag copy was unavailable. Add /mouse [on|off], Ctrl+Shift+M, and re-enter respect for the choice after interactive slash commands.
Ctrl+Alt+M (and Ctrl+Shift+M when kitty keyboard is safe) flip mouse_capture via a helper instead of rewriting the composer and submitting /mouse. Do not advertise Ctrl+Shift+M on denylisted hosts.
Write the stub opener via temp+rename under a unique path so parallel test runners cannot race on a busy binary path (CI Text file busy).
97cd39c to
d05cb25
Compare
Summary
/mouse//mouse on//mouse offand Ctrl+Shift+M toggle capture.with_main_screenre-entry respects the choice.Part of #561 (D5-30). Prerequisite for #558 (hit-rect / hover).
Test plan
toggle_mouse_capture_via_slash/mouse offthen drag-select in terminal