doNothingWhenThereIsNoSelection function

ExecutionInstruction doNothingWhenThereIsNoSelection({
  1. required SuperEditorContext editContext,
  2. required KeyEvent keyEvent,
})

Implementation

ExecutionInstruction doNothingWhenThereIsNoSelection({
  required SuperEditorContext editContext,
  required KeyEvent keyEvent,
}) {
  if (keyEvent is! KeyDownEvent && keyEvent is! KeyRepeatEvent) {
    return ExecutionInstruction.continueExecution;
  }

  if (editContext.composer.selection == null) {
    return ExecutionInstruction.haltExecution;
  } else {
    return ExecutionInstruction.continueExecution;
  }
}