Skip to content

#817: TUI runs two double-click detectors — adopt quadraui DoubleClickDetector and delete the hand-rolled 400ms window - #844

Merged
JDonaghy merged 2 commits into
developfrom
issue-817-tui-runs-two-double-click-detectors-adop
Sep 5, 2026
Merged

#817: TUI runs two double-click detectors — adopt quadraui DoubleClickDetector and delete the hand-rolled 400ms window#844
JDonaghy merged 2 commits into
developfrom
issue-817-tui-runs-two-double-click-detectors-adop

Conversation

@JDonaghy

@JDonaghy JDonaghy commented Sep 5, 2026

Copy link
Copy Markdown
Owner

Closes #817

Automated PR opened by coordinator for review of issue #817.

… timer

mouse::handle_mouse ran a second, independent 400ms/position double-click
detector (last_click_time/last_click_pos) at five sites, racing the
DoubleClickDetector TuiBackend already runs to produce the UiEvent::DoubleClick
that reaches TuiShellApp::handle_mouse_event. Replace the hand-rolled state
with a single `is_double_click: bool` parameter captured from the real
UiEvent::DoubleClick before it's folded to a crossterm MouseEvent, and read it
directly at all five sites (find/replace input, ext panel row, git/sc sidebar
row, settings row, editor word-select) instead of re-deriving it.

Net effect: handle_mouse drops from 33 to 32 parameters (one hand-rolled
timer's worth), and the two detectors that could disagree collapse into one.

GTK already routes UiEvent::DoubleClick straight to its handlers with no
duplicate detector — no change needed there.

Adds two black-box regression tests via TuiDriver: double-click word
selection in the editor (using TuiDriver::double_click, quadraui#592's
deterministic non-wall-clock double-click event) and double-click toggling a
boolean settings row. Both were verified red against the pre-fix behavior
(is_double hardcoded false) and green with the fix.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…nd SC-sidebar sites

The review flagged that the original fix removed the hand-rolled 400ms
detector at all five mouse.rs call sites but only added regression tests
for two (editor word-select, settings toggle). Add the two the issue's
Acceptance section names explicitly:

- tui_ext_panel_double_click_on_a_section_header_does_not_toggle_it:
  double-clicking an extension-panel section header must not toggle its
  expand/collapse state (handle_ext_panel_double_click no-ops on header
  rows; the single-click Return toggle must be suppressed).
- tui_sc_sidebar_double_click_on_a_changed_file_opens_it: double-clicking
  a changed file's row in the source-control sidebar must open it via
  sc_activate_row, same as double-clicking a file in the Explorer.

Both use TuiDriver::double_click to deliver a single synthetic
UiEvent::DoubleClick with no preceding click, and both were verified RED
(by temporarily hardcoding each arm's is_double to false) against the
behavior the deleted hand-rolled detector would have produced for a lone
injected event: no prior last_click_time to compare against, so it would
have read as an ordinary first click.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@JDonaghy
JDonaghy merged commit f989712 into develop Sep 5, 2026
2 checks passed
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.

TUI runs two double-click detectors — adopt quadraui DoubleClickDetector and delete the hand-rolled 400ms window

1 participant