wrapSelection method
Wraps the current selection with before and after.
If after is omitted, before is used for both sides.
Returns false when there is no active selection.
Implementation
bool wrapSelection(String before, {String? after}) {
if (!_hasSelection()) return false;
return _runEditFrame(() {
_beginHistoryAction(_TextAreaHistoryAction.transform, breakChain: true);
_refreshDocumentSnapshot();
final result = textWrapSelection(
document: _document,
state: _currentOffsetStateSnapshot(),
before: before,
after: after,
);
if (!result.changed) {
return false;
}
_recordUndoSnapshot();
_applyOffsetCommandResult(result);
return true;
});
}