Context
Follow-up to #508 ("Adopt quadraui TUI text-selection + OSC52 clipboard").
Part 1 (clipboard delegation) landed on
issue-508-adopt-quadraui-tui-text-selection-osc52. Part 3 (this issue) was
scoped out during that work — smoke-tested and confirmed out of scope for
that branch.
Context resolved from #508
The open question on #508 is resolved: quadraui::DragTarget::TextSelection
has no explicit payload field, but region is a WidgetId (String-like), so
window/line context can be encoded the same way existing scrollbar widget ids
already are (e.g. tui:editor:<window_id>:vsb, see
mouse.rs::apply_scrollbar_drag). No quadraui-side change is needed —
this is implementable entirely on the vimcode side through the existing API.
Why deferred despite being unblocked
The editor's visual-selection drag is document-model, not just a widget
drag: window_zone_hit_test → WindowZone::TextArea { buf_line, col } → engine.mouse_drag(window, line, col) (src/tui_main/mouse.rs:1004). That
document mapping must stay in the engine regardless.
Folding the drag-origin arbitration under DragState/DragTarget only
replaces a bool flag (mouse_text_drag) with a DragTarget match — a
marginal LOC win — for real risk to vim visual-selection correctness across
split windows (multiple editor windows/panes each with their own drag
origin). This needs a written design first, not a rushed swap.
Work
- Design how
DragTarget::TextSelection's region: WidgetId encodes
(window_id, origin_line, origin_col) or equivalent, following the
tui:editor:<window_id>:vsb-style convention already used for scrollbars.
- Move the drag-origin arbitration + gesture lifecycle
(mouse_text_drag bookkeeping in src/tui_main/mouse.rs) onto quadraui's
DragTarget dispatch, mirroring how scrollbar drag already flows through
quadraui::dispatch_mouse_drag (src/tui_main/mouse.rs:51).
- Keep the actual document-model hit-testing
(window_zone_hit_test → buf_line/col → engine.mouse_drag) unchanged in
the engine — only the drag-origin arbitration moves.
- Verify behavior explicitly across split windows: starting a visual-mode
drag in one split must not be hijacked by, or leak into, another split's
drag state.
Acceptance
- Editor mouse-drag visual selection dispatches through quadraui
DragTarget::TextSelection for drag-origin arbitration.
src/tui_main/mouse.rs's bespoke mouse_text_drag bookkeeping shrinks or
is removed.
- Vim visual-selection semantics (character-wise drag selection, extending
across split windows correctly, no cross-split drag leakage) are
unchanged from current behavior — needs explicit multi-split manual
verification, not just single-window testing.
Blocked on: none (quadraui#269/#283 already landed; payload-encoding question
already resolved above). Depends on: #508 Part 1 merged first for shared
context, but not a hard code dependency.
Context
Follow-up to #508 ("Adopt quadraui TUI text-selection + OSC52 clipboard").
Part 1 (clipboard delegation) landed on
issue-508-adopt-quadraui-tui-text-selection-osc52. Part 3 (this issue) wasscoped out during that work — smoke-tested and confirmed out of scope for
that branch.
Context resolved from #508
The open question on #508 is resolved:
quadraui::DragTarget::TextSelectionhas no explicit payload field, but
regionis aWidgetId(String-like), sowindow/line context can be encoded the same way existing scrollbar widget ids
already are (e.g.
tui:editor:<window_id>:vsb, seemouse.rs::apply_scrollbar_drag). No quadraui-side change is needed —this is implementable entirely on the vimcode side through the existing API.
Why deferred despite being unblocked
The editor's visual-selection drag is document-model, not just a widget
drag:
window_zone_hit_test → WindowZone::TextArea { buf_line, col } → engine.mouse_drag(window, line, col)(src/tui_main/mouse.rs:1004). Thatdocument mapping must stay in the engine regardless.
Folding the drag-origin arbitration under
DragState/DragTargetonlyreplaces a bool flag (
mouse_text_drag) with aDragTargetmatch — amarginal LOC win — for real risk to vim visual-selection correctness across
split windows (multiple editor windows/panes each with their own drag
origin). This needs a written design first, not a rushed swap.
Work
DragTarget::TextSelection'sregion: WidgetIdencodes(window_id, origin_line, origin_col)or equivalent, following thetui:editor:<window_id>:vsb-style convention already used for scrollbars.(
mouse_text_dragbookkeeping insrc/tui_main/mouse.rs) onto quadraui'sDragTargetdispatch, mirroring how scrollbar drag already flows throughquadraui::dispatch_mouse_drag(src/tui_main/mouse.rs:51).(
window_zone_hit_test → buf_line/col → engine.mouse_drag) unchanged inthe engine — only the drag-origin arbitration moves.
drag in one split must not be hijacked by, or leak into, another split's
drag state.
Acceptance
DragTarget::TextSelectionfor drag-origin arbitration.src/tui_main/mouse.rs's bespokemouse_text_dragbookkeeping shrinks oris removed.
across split windows correctly, no cross-split drag leakage) are
unchanged from current behavior — needs explicit multi-split manual
verification, not just single-window testing.
Blocked on: none (quadraui#269/#283 already landed; payload-encoding question
already resolved above). Depends on: #508 Part 1 merged first for shared
context, but not a hard code dependency.