moveMultiCursorsRight method

void moveMultiCursorsRight({
  1. bool isShiftPressed = false,
})

Moves every secondary cursor one character to the right.

When isShiftPressed is true the secondary cursors are cleared.

Implementation

void moveMultiCursorsRight({bool isShiftPressed = false}) {
  if (_multiCursors.isEmpty) return;
  if (isShiftPressed) {
    clearMultiCursors();
    return;
  }
  final updated = <({int line, int character})>[];
  for (final cursor in _multiCursors) {
    final offset = _multiCursorToOffset(cursor);
    final newOffset = (offset + 1).clamp(0, _rope.length);
    final newLine = _rope.getLineAtOffset(newOffset);
    final newLineStart = _rope.getLineStartOffset(newLine);
    updated.add((line: newLine, character: newOffset - newLineStart));
  }
  _updateMultiCursorsFromList(updated);
}