Skip to content

Commit 6763bec

Browse files
committed
Use UndoGroup to ensure action ended if exception occurs.
1 parent f61756c commit 6763bec

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

cocoa/ScintillaCocoa.mm

+6-5
Original file line numberDiff line numberDiff line change
@@ -1102,11 +1102,12 @@ bool SupportAnimatedFind() {
11021102
// No data or no flavor we support.
11031103
return;
11041104

1105-
pdoc->BeginUndoAction();
1106-
ClearSelection(false);
1107-
InsertPasteShape(selectedText.Data(), selectedText.Length(),
1108-
selectedText.rectangular ? PasteShape::rectangular : PasteShape::stream);
1109-
pdoc->EndUndoAction();
1105+
{
1106+
UndoGroup ug(pdoc);
1107+
ClearSelection(false);
1108+
InsertPasteShape(selectedText.Data(), selectedText.Length(),
1109+
selectedText.rectangular ? PasteShape::rectangular : PasteShape::stream);
1110+
}
11101111

11111112
Redraw();
11121113
EnsureCaretVisible();

win32/ScintillaWin.cxx

+1-2
Original file line numberDiff line numberDiff line change
@@ -1167,10 +1167,9 @@ void ScintillaWin::SelectionToHangul() {
11671167

11681168
if (converted) {
11691169
documentStr = StringEncode(uniStr, CodePageOfDocument());
1170-
pdoc->BeginUndoAction();
1170+
UndoGroup ug(pdoc);
11711171
ClearSelection();
11721172
InsertPaste(&documentStr[0], documentStr.size());
1173-
pdoc->EndUndoAction();
11741173
}
11751174
}
11761175
}

0 commit comments

Comments
 (0)