TerminalSelectionRange
Immutable selection range in one component binding and terminal layout.
Create ranges through SwingTerminal.createSelectionRange. Retain a range to restore it through SwingTerminal.setSelection. A range does not retain the component or session. It describes a region, not a frozen text snapshot.
Rows are absolute physical rows, including scrollback. A frame's first row is discardedCount + historySize - scrollbackOffset. Columns are half-open cell edges in 0..columns. Direction follows the anchor and caret. Linear columns follow stored text order; block columns follow visual order. Painting and copying include complete wide cells and grapheme clusters. Stored edges remain unchanged when they intersect a wide cell.
Scrolling preserves coordinates. Reflow, history replacement, binding changes, and observed buffer switches invalidate ranges. Evicted endpoints prevent restoration. Ordinary cell edits change the text within the selected region.