From a465db59fb83fe6fe20d18b69a23d3e7e44432a9 Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Mon, 18 Jul 2005 00:50:46 +0000 Subject: Fix for bug #1239832 where typing in overstrike mode was undone in two steps rather than one. --- src/Editor.cxx | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/Editor.cxx') diff --git a/src/Editor.cxx b/src/Editor.cxx index 82675d3a2..d81e5aa00 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -3243,9 +3243,12 @@ void Editor::AddChar(char ch) { void Editor::AddCharUTF(char *s, unsigned int len, bool treatAsDBCS) { bool wasSelection = currentPos != anchor; ClearSelection(); + bool charReplaceAction = false; if (inOverstrike && !wasSelection && !RangeContainsProtected(currentPos, currentPos + 1)) { if (currentPos < (pdoc->Length())) { if (!IsEOLChar(pdoc->CharAt(currentPos))) { + charReplaceAction = true; + pdoc->BeginUndoAction(); pdoc->DelChar(currentPos); } } @@ -3253,6 +3256,9 @@ void Editor::AddCharUTF(char *s, unsigned int len, bool treatAsDBCS) { if (pdoc->InsertString(currentPos, s, len)) { SetEmptySelection(currentPos + len); } + if (charReplaceAction) { + pdoc->EndUndoAction(); + } EnsureCaretVisible(); // Avoid blinking during rapid typing: ShowCaretAtCurrentPosition(); -- cgit v1.2.3