From 614fc911b10efab3914eda8b6007dd09a47e785c Mon Sep 17 00:00:00 2001 From: "royqh1979@gmail.com" Date: Tue, 23 Nov 2021 12:53:48 +0800 Subject: [PATCH] - fix: undo "delete word"/"delete to BOL"/"delete to EOL" correct reset caret position --- NEWS.md | 1 + RedPandaIDE/qsynedit/SynEdit.cpp | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/NEWS.md b/NEWS.md index 8cac1ec1..0a9732f6 100644 --- a/NEWS.md +++ b/NEWS.md @@ -4,6 +4,7 @@ Version 0.9.3 For Dev-C++ 7 Beta - fix: restore caret position after reformat code - enhancement: ask user to rebuild project, when run/debug the project and it has been modified - fix: correct set the enabled state of "delete line"/"insert line"/"delete word"/"delete to BOL"/"delete to EOL" menu items + - fix: undo "delete word"/"delete to BOL"/"delete to EOL" correct reset caret position Version 0.9.2 For Dev-C++ 7 Beta - fix: gutter of the disassembly code control in the cpu info dialog is grayed diff --git a/RedPandaIDE/qsynedit/SynEdit.cpp b/RedPandaIDE/qsynedit/SynEdit.cpp index 3c1793f3..29f3c88d 100644 --- a/RedPandaIDE/qsynedit/SynEdit.cpp +++ b/RedPandaIDE/qsynedit/SynEdit.cpp @@ -5246,13 +5246,18 @@ void SynEdit::deleteFromTo(const BufferCoord &start, const BufferCoord &end) return; doOnPaintTransient(SynTransientType::ttBefore); if ((start.Char != end.Char) || (start.Line != end.Line)) { + BufferCoord oldCaret = caretXY(); setBlockBegin(start); setBlockEnd(end); setActiveSelectionMode(SynSelectionMode::smNormal); QString helper = selText(); setSelTextPrimitive(""); + mUndoList->BeginBlock(); + mUndoList->AddChange(SynChangeReason::crCaret, oldCaret, start, + "", SynSelectionMode::smNormal); mUndoList->AddChange(SynChangeReason::crSilentDeleteAfterCursor, start, end, helper, SynSelectionMode::smNormal); + mUndoList->EndBlock(); internalSetCaretXY(start); } doOnPaintTransient(SynTransientType::ttAfter);