forEachChangeReversed
public inline fun ChangeList.forEachChangeReversed(
block: (range: TextRange, originalRange: TextRange) -> Unit
)
Iterates over all changes in this ChangeList in reverse order of their appearance in the text (from the highest character offset down to the lowest).
In each iteration, block receives range (the range of the change in the updated TextFieldBuffer) and originalRange (the corresponding range in the original text buffer before any changes).
Unlike forEachChange, you may safely make non-overlapping changes after the current range without triggering repeated iterations.
Because iteration proceeds backward by index, any new changes made after the current range are assigned greater indices in the ChangeList and fall beyond the current loop index, so they are cleanly skipped.
For example, suppose ChangeList has changes at index 0 (0..2) and index 1 (10..12). This function visits index 1 first. If you then insert text at index 15, the new change is appended at index 2. Since the loop next decrements to index 0, the new change at index 2 is skipped.
Parameters
| block | The block to be invoked for each change. |