fix(tui): re-arm mouse capture on FocusGained

Pre-existing gap exposed during v0.8.24 testing: when the user clicks
away (Cmd+Tab, opens the screenshot tool, etc.) and clicks back, some
terminals drop the application's mouse-tracking mode. The
\`FocusGained\` handler at \`ui.rs::1599\` already re-pushed keyboard
enhancement flags to recover IME state — extend the same recovery to
\`EnableMouseCapture\` so wheel scroll keeps working after a focus
round-trip. Gated on \`app.use_mouse_capture\` so explicit
\`--no-mouse-capture\` users aren't re-enabled against their will.
This commit is contained in:
Hunter Bown
2026-05-09 02:17:22 -05:00
parent 54ca5718d2
commit 5f9f5ed558
2 changed files with 13 additions and 1 deletions
+7 -1
View File
@@ -5,13 +5,19 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [0.8.24] - 2026-05-08
## [0.8.24] - 2026-05-09
A bugfix + refactor release picking up the backlog after the v0.8.23 security
release.
### Fixed
- **Mouse-wheel scroll survives focus toggles** — on macOS, switching away
(Cmd+Tab, opening the screenshot tool, etc.) and back can drop the
terminal's mouse-tracking mode, leaving wheel scroll dead until restart.
The TUI now re-arms `EnableMouseCapture` on `FocusGained` alongside the
existing keyboard-mode recapture, so wheel events keep flowing after a
focus round-trip.
- **Workspace-local slash commands are now loaded (#1259)** — user command
files placed in `<workspace>/.deepseek/commands/`,
`<workspace>/.claude/commands/`, and `<workspace>/.cursor/commands/` are
+6
View File
@@ -1596,8 +1596,14 @@ async fn run_event_loop(
// terminal's keyboard mode, which breaks IME compositor state.
// Acknowledging FocusGained and re-pushing the flags restores
// the IME so CJK input methods work after a focus toggle.
// The same reset can drop the terminal's mouse-tracking mode,
// leaving wheel scroll dead until restart — re-arm mouse
// capture on focus-gain so wheel events keep flowing.
if terminal_event_needs_viewport_recapture(&evt) {
push_keyboard_enhancement_flags(terminal.backend_mut());
if app.use_mouse_capture {
let _ = execute!(terminal.backend_mut(), EnableMouseCapture);
}
force_terminal_repaint = true;
app.needs_redraw = true;
}