aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/Editor.cxx4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/Editor.cxx b/src/Editor.cxx
index 9562bd4cc..77e74c75e 100644
--- a/src/Editor.cxx
+++ b/src/Editor.cxx
@@ -5666,8 +5666,10 @@ int Editor::ReplaceTarget(bool replacePatterns, const char *text, int length) {
length = istrlen(text);
if (replacePatterns) {
text = pdoc->SubstituteByPosition(text, &length);
- if (!text)
+ if (!text) {
+ pdoc->EndUndoAction();
return 0;
+ }
}
if (targetStart != targetEnd)
pdoc->DeleteChars(targetStart, targetEnd - targetStart);