selection property
BufferRange?
get
selection
The selected range, or null when nothing is selected (or the
anchors of the selection left the buffer). Its end is exclusive, as
in xterm: a selection of one cell at (x, y) ends at (x + 1, y).
Implementation
BufferRange? get selection {
final vt = _liveEngine;
if (vt != null && !_anchorSelection) {
final current = _readScreenSelection(vt);
if (current == null) return null;
final begin = CellOffset(current.start.x, current.start.y);
final end = CellOffset(current.end.x + 1, current.end.y);
return current.rectangle
? BufferRangeBlock(begin, end)
: BufferRangeLine(begin, end);
}
final base = _selectionBase;
final extent = _selectionExtent;
if (base == null || extent == null) {
return null;
}
if (!base.attached || !extent.attached) {
return null;
}
return _createRange(base.offset, extent.offset);
}