I’m writing a plugin which inserts many characters in all the selections (i.e. in several regions).
I’m using view.replace(region, "newstring")
to replace each region with the new string.
My problem is, when someone hits “undo” (ctrl+z), it will undo the replacements one at a time, and not all at once.
This is contrary to the way it work when just writing text in multiple selections, where “undo” will undo all the written lines at once.
What’s the best way to make my plugin support “undo”?
Thanks,
Edan