moveCursorToVisualLineBoundary function
TextCursorCommandResult
moveCursorToVisualLineBoundary(
- TextDocument document,
- EditorState state,
- TextView view, {
- required int cursorOffset,
- int? selectionBaseOffset,
- int? selectionExtentOffset,
- required bool end,
- bool extendSelection = false,
- bool clearSelection = true,
- bool preserveCollapsedSelection = false,
Implementation
TextCursorCommandResult moveCursorToVisualLineBoundary(
TextDocument document,
EditorState state,
TextView view, {
required int cursorOffset,
int? selectionBaseOffset,
int? selectionExtentOffset,
required bool end,
bool extendSelection = false,
bool clearSelection = true,
bool preserveCollapsedSelection = false,
}) {
final cursor = document.positionForOffset(
cursorOffset.clamp(0, document.length),
);
final targetOffset = view.cursorOffsetForVisualLineBoundary(
document,
state,
end: end,
cursor: cursor,
);
return moveCursorToOffset(
textLength: document.length,
cursorOffset: cursorOffset,
selectionBaseOffset: selectionBaseOffset,
selectionExtentOffset: selectionExtentOffset,
targetOffset: targetOffset,
extendSelection: extendSelection,
clearSelection: clearSelection,
preserveCollapsedSelection: preserveCollapsedSelection,
);
}