Use UndoGroup to ensure action ended if exception occurs.

This commit is contained in:
Neil
2024-08-27 08:08:05 +10:00
parent f61756ccb2
commit 6763becbfc
2 changed files with 7 additions and 7 deletions

View File

@@ -1102,11 +1102,12 @@ void ScintillaCocoa::Paste(bool forceRectangular) {
// No data or no flavor we support.
return;
pdoc->BeginUndoAction();
ClearSelection(false);
InsertPasteShape(selectedText.Data(), selectedText.Length(),
selectedText.rectangular ? PasteShape::rectangular : PasteShape::stream);
pdoc->EndUndoAction();
{
UndoGroup ug(pdoc);
ClearSelection(false);
InsertPasteShape(selectedText.Data(), selectedText.Length(),
selectedText.rectangular ? PasteShape::rectangular : PasteShape::stream);
}
Redraw();
EnsureCaretVisible();

View File

@@ -1167,10 +1167,9 @@ void ScintillaWin::SelectionToHangul() {
if (converted) {
documentStr = StringEncode(uniStr, CodePageOfDocument());
pdoc->BeginUndoAction();
UndoGroup ug(pdoc);
ClearSelection();
InsertPaste(&documentStr[0], documentStr.size());
pdoc->EndUndoAction();
}
}
}