textMoveToDocumentBoundary function

TextCursorCommandResult textMoveToDocumentBoundary({
  1. required TextDocument document,
  2. required TextOffsetStateSnapshot state,
  3. required bool forward,
  4. bool extendSelection = false,
  5. bool clearSelection = false,
})

Implementation

TextCursorCommandResult textMoveToDocumentBoundary({
  required TextDocument document,
  required TextOffsetStateSnapshot state,
  required bool forward,
  bool extendSelection = false,
  bool clearSelection = false,
}) {
  return moveCursorToOffset(
    textLength: document.length,
    cursorOffset: state.cursorOffset,
    selectionBaseOffset: state.selectionBaseOffset,
    selectionExtentOffset: state.selectionExtentOffset,
    targetOffset: forward ? document.length : 0,
    extendSelection: extendSelection,
    clearSelection: clearSelection,
  );
}