| 98 | } |
| 99 | |
| 100 | export function updateSelection( |
| 101 | s: SelectionState, |
| 102 | col: number, |
| 103 | row: number, |
| 104 | ): void { |
| 105 | if (!s.isDragging) return |
| 106 | // First motion at the same cell as anchor is a no-op. Terminals in mode |
| 107 | // 1002 can fire a drag event at the anchor cell (sub-pixel tremor, or a |
| 108 | // motion-release pair). Setting focus here would turn a bare click into |
| 109 | // a 1-cell selection and clobber the clipboard via useCopyOnSelect. Once |
| 110 | // focus is set (real drag), we track normally including back to anchor. |
| 111 | if (!s.focus && s.anchor && s.anchor.col === col && s.anchor.row === row) |
| 112 | return |
| 113 | s.focus = { col, row } |
| 114 | } |
| 115 | |
| 116 | export function finishSelection(s: SelectionState): void { |
| 117 | s.isDragging = false |