aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2024-08-27 08:08:05 +1000
committerNeil <nyamatongwe@gmail.com>2024-08-27 08:08:05 +1000
commit6763becbfcc14b03e89812bd3ecd74ed9a57e2ba (patch)
treef69cf9c354214806815567228379d1cb0a7f9a42
parentf61756ccb21fdd1893e13c1528fe04cfce4a7c6e (diff)
downloadscintilla-mirror-6763becbfcc14b03e89812bd3ecd74ed9a57e2ba.tar.gz
Use UndoGroup to ensure action ended if exception occurs.
-rw-r--r--cocoa/ScintillaCocoa.mm11
-rw-r--r--win32/ScintillaWin.cxx3
2 files changed, 7 insertions, 7 deletions
diff --git a/cocoa/ScintillaCocoa.mm b/cocoa/ScintillaCocoa.mm
index be71de367..8419a4157 100644
--- a/cocoa/ScintillaCocoa.mm
+++ b/cocoa/ScintillaCocoa.mm
@@ -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();
diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx
index c1b330e61..5fd06cd16 100644
--- a/win32/ScintillaWin.cxx
+++ b/win32/ScintillaWin.cxx
@@ -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();
}
}
}