You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current implementation lacks a function that accepts multiple ranges and corresponding strings for replacement. We need a method similar to the following:
publicfunc replaceCharacters(in ranges:[[NSRange]], with strings:[String])
This function should allow replacing characters in multiple ranges with their respective strings.
While you can call replaceCharacters(_:with:) multiple times, each call is treated as a separate insertion, which creates a misleading undo history.
Example:
Comments:
Screen.Recording.2024-08-20.at.7.13.48.PM.mov
To Reproduce
x
Expected Behavior
x
Version Information
No response
Additional Context
No response
Screenshots
No response
The text was updated successfully, but these errors were encountered:
After starting working on this, I don't think it's a necessary API. If the issue it's solving is undo grouping, you should be able to call textView.undoManager?.beginGrouping() before and textView.undoManager?.endGrouping() after applying all your edits to force the undo manager to group them all into one undo group.
An API call like this would have some requirements that would be hard to indicate through a simple method call. Like requiring all the ranges to be non-overlapping, and requiring that range groups are ordered so that edits can be applied to the text without modifying the given ranges and strings. I think that should be handled by the library consumer.
Description
The current implementation lacks a function that accepts multiple ranges and corresponding strings for replacement. We need a method similar to the following:
This function should allow replacing characters in multiple ranges with their respective strings.
While you can call
replaceCharacters(_:with:)
multiple times, each call is treated as a separate insertion, which creates a misleading undo history.Example:
Comments:
Screen.Recording.2024-08-20.at.7.13.48.PM.mov
To Reproduce
x
Expected Behavior
x
Version Information
No response
Additional Context
No response
Screenshots
No response
The text was updated successfully, but these errors were encountered: