Repository navigation
fix(terminal): improve text selection UX and scroll alignment - #46
Conversation
|
Reviewer's GuideThe PR updates terminal selection flow by preserving xterm anchor ownership during search, sharing scroll state so handles track scrollback, suppressing remote pointer input during selection, and improving copy/UI feedback with focused tests and changelog entries. Sequence diagram for terminal selection and guarded inputsequenceDiagram
actor User
participant Handles as TerminalSelectionHandles
participant Controller as TerminalController
participant Guard as TerminalSelectionInputGuard
participant Remote as RemoteSession
User->>Handles: Drag selection handle
Handles->>Controller: setSelection(...)
Controller-->>Guard: selection changed
Guard->>Controller: setSuspendPointerInput(true)
User->>Remote: Tap or toolbar interaction
Note over Controller,Remote: Pointer forwarding is suspended while selection exists
User->>Controller: clearSelection()
Controller-->>Guard: selection cleared
Guard->>Controller: setSuspendPointerInput(false)
Sequence diagram for search selection anchor ownershipsequenceDiagram
participant Search as TerminalSearchSession
participant Buffer as TerminalBuffer
participant Controller as TerminalController
Search->>Buffer: createAnchorFromOffset(begin)
Search->>Buffer: createAnchorFromOffset(end)
Search->>Controller: setSelection(start, end)
Note over Buffer,Controller: Controller-owned anchors remain valid for copy and handles
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (11 files)
Reviewed by free · Input: 25K · Output: 1.1K · Cached: 246.6K |
Summary
Improves PocketShell terminal text selection after reviewing the xterm selection flow (long-press/drag, toolbar, handles, and search).
Problems addressed
TerminalSearchSession._scrollToCurrentdisposed anchors immediately aftersetSelection, but xterm takes ownership of those anchors — selection became detached and copy/handles failed after jumping to a match.Scrollable, so handles did not repaint when scrollback moved.Changes
createAnchorFromOffsetwithout disposing controller-owned anchors.ScrollControllershared byTerminalViewandTerminalSelectionHandles.TerminalSelectionInputGuardsuspends pointer forwarding while a selection is active.selectedTerminalTexthelper and tests.Test plan
flutter analyzeflutter testSummary by Sourcery
Improve terminal text selection behavior across search, scrolling, handle interaction, and copying.
Bug Fixes:
Enhancements:
Documentation:
Tests: