- fix: undo "delete word"/"delete to BOL"/"delete to EOL" correct reset caret position

This commit is contained in:
royqh1979@gmail.com 2021-11-23 12:53:48 +08:00
parent 9c2ffa2f80
commit 614fc911b1
2 changed files with 6 additions and 0 deletions

View File

@ -4,6 +4,7 @@ Version 0.9.3 For Dev-C++ 7 Beta
- fix: restore caret position after reformat code - fix: restore caret position after reformat code
- enhancement: ask user to rebuild project, when run/debug the project and it has been modified - 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: 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 Version 0.9.2 For Dev-C++ 7 Beta
- fix: gutter of the disassembly code control in the cpu info dialog is grayed - fix: gutter of the disassembly code control in the cpu info dialog is grayed

View File

@ -5246,13 +5246,18 @@ void SynEdit::deleteFromTo(const BufferCoord &start, const BufferCoord &end)
return; return;
doOnPaintTransient(SynTransientType::ttBefore); doOnPaintTransient(SynTransientType::ttBefore);
if ((start.Char != end.Char) || (start.Line != end.Line)) { if ((start.Char != end.Char) || (start.Line != end.Line)) {
BufferCoord oldCaret = caretXY();
setBlockBegin(start); setBlockBegin(start);
setBlockEnd(end); setBlockEnd(end);
setActiveSelectionMode(SynSelectionMode::smNormal); setActiveSelectionMode(SynSelectionMode::smNormal);
QString helper = selText(); QString helper = selText();
setSelTextPrimitive(""); setSelTextPrimitive("");
mUndoList->BeginBlock();
mUndoList->AddChange(SynChangeReason::crCaret, oldCaret, start,
"", SynSelectionMode::smNormal);
mUndoList->AddChange(SynChangeReason::crSilentDeleteAfterCursor, start, end, mUndoList->AddChange(SynChangeReason::crSilentDeleteAfterCursor, start, end,
helper, SynSelectionMode::smNormal); helper, SynSelectionMode::smNormal);
mUndoList->EndBlock();
internalSetCaretXY(start); internalSetCaretXY(start);
} }
doOnPaintTransient(SynTransientType::ttAfter); doOnPaintTransient(SynTransientType::ttAfter);