Skip to content

Let an embedder override the double-tap word selection - #242

Open
lordspace wants to merge 1 commit into
TerminalStudio:masterfrom
orbisius:oterm-double-tap-hook
Open

Let an embedder override the double-tap word selection#242
lordspace wants to merge 1 commit into
TerminalStudio:masterfrom
orbisius:oterm-double-tap-hook

Conversation

@lordspace

Copy link
Copy Markdown

This Fixes #241

Adds TerminalView.onDoubleTapDown(TapDownDetails, CellOffset), mirroring the existing onSecondaryTapDown / onSecondaryTapUp passthrough. When supplied it replaces the built-in selectWord rather than running before it.

Replacing rather than chaining is the point. If the built-in word selection runs first, an embedder's own selection becomes a correction: the word is painted and swapped a frame later, which the user sees as a flicker, and whether the correction wins depends on scheduling order between the embedder's gesture layer and xterm's — not on anything the API promises.

Passing null keeps current behaviour byte-for-byte, so this is purely additive for existing embedders.

Two tests in test/src/ui/double_tap_override_test.dart:

  • with no handler, double-tap still selects the word (default untouched)
  • with a handler, it receives the CellOffset and controller.selection stays null — proving xterm didn't select behind its back

Note: running that test on a clean checkout needs the dart_code_metrics removal from #240, which currently blocks the suite. The code change itself is independent of that PR.

TerminalView gains onDoubleTapDown(TapDownDetails, CellOffset), mirroring
the existing onSecondaryTapDown passthrough. When supplied it REPLACES the
built-in selectWord rather than running after it.

Without a hook an embedder that wants a different double-tap meaning —
select the line, open a file, follow a URL — can only correct the word
selection afterwards, which is visible as a flicker and depends on
scheduling order. Passing null keeps the existing behaviour exactly.
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.

TerminalView gives embedders no way to define their own double-tap selection

1 participant