splitLine method

bool splitLine()

Splits the current line at the cursor, or replaces the selected range with a newline and places the cursor at the start of the new line.

Implementation

bool splitLine() {
  return _runEditFrame(() {
    _beginHistoryAction(_TextAreaHistoryAction.transform, breakChain: true);
    _refreshDocumentSnapshot();
    final result = textSplitLine(
      document: _document,
      state: _currentOffsetStateSnapshot(),
    );
    if (!result.changed) {
      return false;
    }

    _recordUndoSnapshot();
    _applyOffsetCommandResult(result);
    return true;
  });
}