fix dead-wired TerminalView.onTapUp callback (T-93)
test / unit + widget + golden + a11y (push) Failing after 28s
test / integration_test (xvfb) (push) Has been skipped
test / bundle smoke (xvfb 5s) (push) Has been skipped
test / daemon subprocess + web WASM smoke (push) Has been skipped
test / dart doc (lib API) (push) Failing after 59s

`TerminalView.onTapUp` was documented as "Callback for when the
user taps on the terminal" but was wired to a code path nothing
ever invoked:

- `TerminalView.build` passed it via `onTapUp:` to
  `TerminalGestureHandler`,
- which forwarded via `onTapUp:` to `TerminalGestureDetector`,
- whose `onTapUp` field was declared and accepted but never called
  by `_handleTapUp` (which only fires `onSingleTapUp`).

Net: every caller that registered an `onTapUp` callback on
`TerminalView` got silent failure. zero in-tree callers depended
on it (clide_pty_view.dart is the only TerminalView callsite and
doesn't pass any tap callback), but the public API said one thing
and did another.

Fix: wire `_onTapUp` (the cell-resolving state-method) through the
detector's working `onSingleTapUp` slot. The user-facing semantics
("fires on confirmed single tap with the resolved cell offset")
match the only sane interpretation of the docstring, and don't
overlap with the existing `onSecondaryTap*` (which were already
correctly wired through TapGestureRecognizer's secondary callbacks).

Also drops the dead surface that surfaced the bug:
- `TerminalGestureHandler.onTapUp` parameter + field — no caller
  passes it after the fix; was only used to forward into the dead
  detector field.
- `TerminalGestureDetector.onTapUp` parameter + field — never
  invoked by `_handleTapUp`. Pure dead code.

Tests: extends `terminal_view_test.dart` with a primary-tap
regression case + paired tests for selection-clearing and
secondary-tap callback routing. The double-tap recognizer's
300 ms timer is flushed via `pump(const Duration(seconds: 1))`
(pumpAndSettle waits for animations, not arbitrary timers).

Coverage delta:
- terminal_view.dart: 151/188 → 180/188 (95.7%; remaining gaps
  are IME `_onComposing`/`_onEditableRect`/`_onKeyboardShow`
  body branches that need deeper IME mocking).
- gesture_handler.dart: 18/60 → 39/59.
- gesture_detector.dart: 30/50 → 42/50.
- Total project: 65.76% → 66.97%; coverage_floor 65 → 66.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2026-05-07 08:49:09 +02:00
co-authored by Claude
parent fb85dfa6f9
commit 6b7290dc42
7 changed files with 282 additions and 117 deletions
+1 -1
View File
@@ -301,7 +301,7 @@ class TerminalViewState extends State<TerminalView> {
child = TerminalGestureHandler(
terminalView: this,
terminalController: _controller,
onTapUp: _onTapUp,
onSingleTapUp: _onTapUp,
onTapDown: _onTapDown,
onSecondaryTapDown: widget.onSecondaryTapDown != null ? _onSecondaryTapDown : null,
onSecondaryTapUp: widget.onSecondaryTapUp != null ? _onSecondaryTapUp : null,
@@ -10,7 +10,6 @@ class TerminalGestureDetector extends StatefulWidget {
super.key,
this.child,
this.onSingleTapUp,
this.onTapUp,
this.onTapDown,
this.onSecondaryTapDown,
this.onSecondaryTapUp,
@@ -26,8 +25,6 @@ class TerminalGestureDetector extends StatefulWidget {
final Widget? child;
final GestureTapUpCallback? onTapUp;
final GestureTapUpCallback? onSingleTapUp;
final GestureTapDownCallback? onTapDown;
@@ -16,7 +16,6 @@ class TerminalGestureHandler extends StatefulWidget {
required this.terminalView,
required this.terminalController,
this.child,
this.onTapUp,
this.onSingleTapUp,
this.onTapDown,
this.onSecondaryTapDown,
@@ -32,8 +31,6 @@ class TerminalGestureHandler extends StatefulWidget {
final Widget? child;
final GestureTapUpCallback? onTapUp;
final GestureTapUpCallback? onSingleTapUp;
final GestureTapDownCallback? onTapDown;
@@ -64,7 +61,6 @@ class _TerminalGestureHandlerState extends State<TerminalGestureHandler> {
@override
Widget build(BuildContext context) {
return TerminalGestureDetector(
onTapUp: widget.onTapUp,
onSingleTapUp: onSingleTapUp,
onTapDown: onTapDown,
onSecondaryTapDown: onSecondaryTapDown,