replaceAll function
Replace all matches with the replacement text.
Implementation
bool replaceAll(EditorViewState view) {
return _searchCommand(view, (v, state) {
if (v.state.isReadOnly) return false;
final matches = state.query.matchAll(v.state, 1000000000);
if (matches == null || matches.isEmpty) return false;
final changes = matches.map((match) {
return ChangeSpec(
from: match.from,
to: match.to,
insert: state.query.getReplacement(match),
);
}).toList();
v.dispatch([
TransactionSpec(
changes: changes,
userEvent: 'input.replace.all',
),
]);
return true;
});
}