KetraTerm
API · DevelopmentAll versions

CellSelection

data class CellSelection(val anchorColumn: Int, val anchorRow: Int, val caretColumn: Int, val caretRow: Int, val isBlock: Boolean = false)

Half-open terminal cell selection in visible render-cache coordinates.

anchorColumn and anchorRow identify the fixed selection edge. caretColumn and caretRow identify the moving edge and may be before the anchor for backward selections. Columns are caret positions between cells, so selecting cells 2 through 4 on one row is represented as columns 2..5. Linear selections use logical columns in stored text order. Block selections use visual columns and the same horizontal interval on every selected row; copying a block maps its cells back to logical order independently per row. A linear selection crossing a hard row boundary includes its newline even when an endpoint selects no cells on that row. Soft wraps contribute no newline.

Constructors

Link copied to clipboard
constructor(anchorColumn: Int, anchorRow: Int, caretColumn: Int, caretRow: Int, isBlock: Boolean = false)

Properties

Link copied to clipboard

zero-based anchor caret column.

Link copied to clipboard

zero-based anchor row.

Link copied to clipboard

zero-based moving caret column.

Link copied to clipboard

zero-based moving row.

Link copied to clipboard

End-exclusive logical caret column on endRow, or the right visual edge of a block.

Link copied to clipboard
val endRow: Int

Last selected row after normalizing anchor and caret order.

Link copied to clipboard

whether the selection is a rectangular block selection.

Link copied to clipboard

Returns true when the selection covers no cells.

Link copied to clipboard

First logical caret column on startRow, or the left visual edge of a block.

Link copied to clipboard

First selected row after normalizing anchor and caret order.