replaceAll method

int replaceAll()

Replaces all found occurrences across the document in a single atomic undo step. Returns the number of occurrences replaced.

Implementation

int replaceAll() {
  if (searchState.matches.isEmpty) return 0;

  final count = _documentController.replaceAllMatches(
    searchState.matches,
    searchState.replaceText,
    preserveLinks: searchState.options.preserveLinkOnReplace,
  );

  _performSearch();
  return count;
}