sortSelectedLines method

bool sortSelectedLines({
  1. bool descending = false,
  2. bool caseSensitive = false,
})

Sorts the selected lines, or the entire buffer when there is no selection.

Implementation

bool sortSelectedLines({
  bool descending = false,
  bool caseSensitive = false,
}) {
  return _runEditFrame(() {
    _beginHistoryAction(_TextAreaHistoryAction.transform, breakChain: true);
    final result = textSortSelectedLinesDocument(
      document: _document,
      state: _currentLineStateSnapshot(),
      descending: descending,
      caseSensitive: caseSensitive,
    );
    if (!result.changed) {
      return false;
    }

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