Teodor Petrov:
> Also I want it to work for multiple cursors. I've tested a bit the modification in
> Editor::AddCharUTF and it works for this case, but I've not tested it for anything else.
I’d avoid the potential problems by not adding the closing brace when there are multiple selections. Adding a matched brace may help when simply writing new code but when there are multiple selections, the user is probably doing a more complex edit and typing an extra brace is a small cost.
You could look into implementing some more complex undo stack manipulation but that area can be tricky. Say a SCI_CONTINUEUNDOACTION that re-opens the previous undo group (if any) and appends modifications until SCI_ENDUNDOACTION.
> Can you try to predict what problems I might expect with this change to the undo
> grouping behaviour?
AddCharUTF is dealing with multiple issues, including virtual space, protected areas, overstrike (replacement) mode, and ensuring that IME input works well. If your application enables these then check that it works when they are active.
> Do you remember why it has been implemented in this manner?
There is an undo group around multiple selection character adding as that allows them all to be undone in one go.
Neil