replaceSelection method
Replaces the current selection, or inserts at the cursor if collapsed.
Implementation
void replaceSelection(String text) {
_runEditFrame(() {
_beginHistoryAction(_TextInputHistoryAction.replace, breakChain: true);
_resetDesiredCol();
final result = textInsertText(
document: _document,
state: _currentOffsetStateSnapshot(),
text: String.fromCharCodes(uni.codePoints(text)),
);
if (result.changed) {
_recordUndoSnapshot();
_applyEditCommandResult(result);
}
_updateSuggestions();
_handleOverflow();
});
}