Skip to content

Add F2 to toggle mouse capture for terminal-native copy - #116

Merged
github-actions[bot] merged 1 commit into
mainfrom
toggle-mouse-capture
Aug 1, 2026
Merged

github-actions[bot] merged 1 commit into
mainfrom
toggle-mouse-capture

Conversation

@mohitranka

Copy link
Copy Markdown
Contributor

Summary

  • Forge already had a [tui] mouse_capture config setting to disable EnableMouseCapture entirely (restoring native terminal text selection everywhere), but flipping it required editing the config file and restarting.
  • Add an F2 global keybinding (SemanticCommand::ToggleMouseCapture) that flips runtime.mouse_capture live and immediately sends Enable/DisableMouseCapture to the terminal via a new terminal::set_mouse_capture() helper, with a toast confirming the new state.
  • While capture is off, the TUI's own mouse handling is inert (existing guard in mouse.rs) and the terminal emulator receives raw mouse events again, so click-drag selection and the terminal's native copy shortcut work as normal. F2 again re-enables Forge's interactive mouse features.
  • Documented under ? help as "F2 Toggle mouse capture (select/copy in terminal)".

Test plan

  • cargo build -p forge-tui
  • cargo test -p forge-tui --lib — 671 passed, 0 failed
  • cargo clippy -p forge-tui --all-targets — clean
  • cargo fmt --check — clean
  • Manually press F2 in a terminal, confirm click-drag selects text and the terminal's copy shortcut copies it; press F2 again and confirm Forge's mouse scrolling/clicking resumes

Disabling mouse capture already required editing [tui] mouse_capture
in config and restarting. Add a live F2 toggle that flips the runtime
flag and sends Enable/DisableMouseCapture immediately, so users can
drop into native terminal text selection/copy without leaving Forge,
then flip back on for the TUI's own mouse handling.
@github-actions
github-actions Bot enabled auto-merge (squash) August 1, 2026 11:22
@github-actions
github-actions Bot merged commit cccf62e into main Aug 1, 2026
6 checks passed
mohitranka added a commit that referenced this pull request Aug 1, 2026
Revert the F2 binding, SemanticCommand::ToggleMouseCapture, and
terminal::set_mouse_capture added in #116.
github-actions Bot pushed a commit that referenced this pull request Aug 1, 2026
Revert the F2 binding, SemanticCommand::ToggleMouseCapture, and
terminal::set_mouse_capture added in #116.
mohitranka added a commit that referenced this pull request Aug 21, 2026
Disabling mouse capture already required editing [tui] mouse_capture
in config and restarting. Add a live F2 toggle that flips the runtime
flag and sends Enable/DisableMouseCapture immediately, so users can
drop into native terminal text selection/copy without leaving Forge,
then flip back on for the TUI's own mouse handling.
mohitranka added a commit that referenced this pull request Aug 21, 2026
Revert the F2 binding, SemanticCommand::ToggleMouseCapture, and
terminal::set_mouse_capture added in #116.
mohitranka added a commit that referenced this pull request Sep 11, 2026
Disabling mouse capture already required editing [tui] mouse_capture
in config and restarting. Add a live F2 toggle that flips the runtime
flag and sends Enable/DisableMouseCapture immediately, so users can
drop into native terminal text selection/copy without leaving Forge,
then flip back on for the TUI's own mouse handling.
mohitranka added a commit that referenced this pull request Sep 11, 2026
Revert the F2 binding, SemanticCommand::ToggleMouseCapture, and
terminal::set_mouse_capture added in #116.
mohitranka added a commit that referenced this pull request Sep 11, 2026
Disabling mouse capture already required editing [tui] mouse_capture
in config and restarting. Add a live F2 toggle that flips the runtime
flag and sends Enable/DisableMouseCapture immediately, so users can
drop into native terminal text selection/copy without leaving Forge,
then flip back on for the TUI's own mouse handling.
mohitranka added a commit that referenced this pull request Sep 11, 2026
Revert the F2 binding, SemanticCommand::ToggleMouseCapture, and
terminal::set_mouse_capture added in #116.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant