remove dead tertiary-tap surface (T-95)
test / unit + widget + golden + a11y (push) Failing after 30s
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 1m1s

The middle-click ("tertiary tap") path in TerminalGestureHandler was
wired wrong: build() bound onTertiaryTapDown to the secondary state
method, so a middle-click fired as if it were a right-click. The
state's onTertiaryTapDown/Up methods were unreachable, and the
onTertiaryTapUp body had a copy-paste bug (button=right instead of
middle). No production caller passed onTertiaryTapDown / onTertiaryTapUp
through, and TerminalView didn't expose them either, so the public
parameters were dead too.

Drops both layers of dead surface — option B of T-95. Same shape as
T-93's resolution (delete unused, restore later when a real consumer
needs it). Also collapses the unreachable onDragStart selectWord
branch (PanGestureRecognizer is mouse-only, so the touch path can't
fire) into a single selectCharacters call with a comment.

Companion: refines the reflow-padding test in coverage_trivials_test
to use narrow→wide reflow setup (more honest about intent, also
actually exercises the padding branch — Buffer.resize now 100%) and
clears two unnecessary_import warnings surfaced by the deletion.

Coverage: gesture_handler 55/59 -> 59/59; gesture_detector 50/50;
buffer/buffer 260/261 -> 261/261.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-11 17:56:24 +02:00
co-authored by Claude Opus 4.7
parent 155af91e66
commit 0a43a1f7d2
4 changed files with 12 additions and 36 deletions
@@ -13,8 +13,6 @@ class TerminalGestureDetector extends StatefulWidget {
this.onTapDown,
this.onSecondaryTapDown,
this.onSecondaryTapUp,
this.onTertiaryTapDown,
this.onTertiaryTapUp,
this.onLongPressStart,
this.onLongPressMoveUpdate,
this.onLongPressUp,
@@ -35,10 +33,6 @@ class TerminalGestureDetector extends StatefulWidget {
final GestureTapDownCallback? onDoubleTapDown;
final GestureTapDownCallback? onTertiaryTapDown;
final GestureTapUpCallback? onTertiaryTapUp;
final GestureLongPressStartCallback? onLongPressStart;
final GestureLongPressMoveUpdateCallback? onLongPressMoveUpdate;
@@ -112,9 +106,7 @@ class _TerminalGestureDetectorState extends State<TerminalGestureDetector> {
..onTapDown = _handleTapDown
..onTapUp = _handleTapUp
..onSecondaryTapDown = widget.onSecondaryTapDown
..onSecondaryTapUp = widget.onSecondaryTapUp
..onTertiaryTapDown = widget.onTertiaryTapDown
..onTertiaryTapUp = widget.onTertiaryTapUp;
..onSecondaryTapUp = widget.onSecondaryTapUp;
},
);
@@ -1,6 +1,5 @@
// Based on xterm.dart v4.0.0 by xuty (MIT). See LICENSE in this directory.
import 'package:flutter/gestures.dart';
import 'package:flutter/widgets.dart';
import 'package:clide/src/terminal/src/core/mouse/button.dart';
import 'package:clide/src/terminal/src/core/mouse/button_state.dart';
@@ -20,8 +19,6 @@ class TerminalGestureHandler extends StatefulWidget {
this.onTapDown,
this.onSecondaryTapDown,
this.onSecondaryTapUp,
this.onTertiaryTapDown,
this.onTertiaryTapUp,
this.readOnly = false,
});
@@ -39,10 +36,6 @@ class TerminalGestureHandler extends StatefulWidget {
final GestureTapUpCallback? onSecondaryTapUp;
final GestureTapDownCallback? onTertiaryTapDown;
final GestureTapUpCallback? onTertiaryTapUp;
final bool readOnly;
@override
@@ -65,8 +58,6 @@ class _TerminalGestureHandlerState extends State<TerminalGestureHandler> {
onTapDown: onTapDown,
onSecondaryTapDown: onSecondaryTapDown,
onSecondaryTapUp: onSecondaryTapUp,
onTertiaryTapDown: onSecondaryTapDown,
onTertiaryTapUp: onSecondaryTapUp,
onLongPressStart: onLongPressStart,
onLongPressMoveUpdate: onLongPressMoveUpdate,
// onLongPressUp: onLongPressUp,
@@ -144,14 +135,6 @@ class _TerminalGestureHandlerState extends State<TerminalGestureHandler> {
_tapUp(widget.onSecondaryTapUp, details, TerminalMouseButton.right);
}
void onTertiaryTapDown(TapDownDetails details) {
_tapDown(widget.onTertiaryTapDown, details, TerminalMouseButton.middle);
}
void onTertiaryTapUp(TapUpDetails details) {
_tapUp(widget.onTertiaryTapUp, details, TerminalMouseButton.right);
}
void onDoubleTapDown(TapDownDetails details) {
renderTerminal.selectWord(details.localPosition);
}
@@ -172,8 +155,10 @@ class _TerminalGestureHandlerState extends State<TerminalGestureHandler> {
void onDragStart(DragStartDetails details) {
_lastDragStartDetails = details;
details.kind == PointerDeviceKind.mouse ? renderTerminal.selectCharacters(details.localPosition) : renderTerminal.selectWord(details.localPosition);
// PanGestureRecognizer in TerminalGestureDetector only registers
// PointerDeviceKind.mouse, so we know the drag came from a mouse and
// characters are the right selection unit.
renderTerminal.selectCharacters(details.localPosition);
}
void onDragUpdate(DragUpdateDetails details) {
+7 -7
View File
@@ -35,13 +35,13 @@ void main() {
test('Buffer.resize pads reflow output up to the new height', () {
final t = Terminal(maxLines: 200, onOutput: (_) {});
// Write content narrower than the new width — reflow should produce
// fewer lines than newHeight, triggering the pad-with-empty-lines
// branch in buffer.dart.
t.write('abc\r\n');
// Resize to a wide + tall viewport.
t.resize(40, 50, 8, 16);
expect(t.buffer.lines.length, greaterThanOrEqualTo(50));
// Setup: narrow viewport with wrapped continuation lines. Widening
// collapses them in reflow → output rows < newHeight → the
// pad-with-empty-lines branch in Buffer.resize runs.
t.resize(5, 30, 8, 16);
t.write('aaaaaaaaaaaaaaaaaaaa'); // wraps 4 times
t.resize(80, 30, 8, 16); // widen, same height
expect(t.buffer.lines.length, 30);
});
test('TerminalPainter.paintLine handles wide (CJK) cells without skipping the skip', () {
-1
View File
@@ -11,7 +11,6 @@ import 'package:clide/src/terminal/src/ui/controller.dart';
import 'package:clide/src/terminal/src/ui/cursor_type.dart';
import 'package:clide/src/terminal/src/ui/terminal_text_style.dart';
import 'package:clide/src/terminal/src/ui/themes.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_test/flutter_test.dart';