expandSelectionWithUpArrow top-level property

ReadOnlyDocumentKeyboardAction expandSelectionWithUpArrow
final

Implementation

final expandSelectionWithUpArrow = createShortcut(
  ({
    required SuperReaderContext documentContext,
    required KeyEvent keyEvent,
  }) {
    if (defaultTargetPlatform == TargetPlatform.windows && HardwareKeyboard.instance.isAltPressed) {
      return ExecutionInstruction.continueExecution;
    }

    if (defaultTargetPlatform == TargetPlatform.linux && HardwareKeyboard.instance.isAltPressed) {
      return ExecutionInstruction.continueExecution;
    }

    final didMove = moveCaretUp(
      document: documentContext.document,
      documentLayout: documentContext.documentLayout,
      selectionNotifier: documentContext.selection,
      retainCollapsedSelection: HardwareKeyboard.instance.isShiftPressed,
    );

    return didMove ? ExecutionInstruction.haltExecution : ExecutionInstruction.continueExecution;
  },
  keyPressedOrReleased: LogicalKeyboardKey.arrowUp,
);