- fix: correctly reset caret when redo cut with no selection

This commit is contained in:
Roy Qu 2022-03-15 00:15:35 +08:00
parent 1a0267de7b
commit 5a338ef892
2 changed files with 23 additions and 2 deletions

View File

@ -14,6 +14,8 @@ Red Panda C++ Version 1.0.0
- enhancement: toggle block comment - enhancement: toggle block comment
- fix: syntax color of #include header filenames not correct - fix: syntax color of #include header filenames not correct
- fix: when no selection, copy/cut should auto select whole line with the line break - fix: when no selection, copy/cut should auto select whole line with the line break
- fix: redo cut with no selection while make whole line selected
- fix: correctly reset caret when redo cut with no selection
Red Panda C++ Version 0.14.5 Red Panda C++ Version 0.14.5
- fix: the "gnu c++ 20" option in compiler set options is wrong - fix: the "gnu c++ 20" option in compiler set options is wrong

View File

@ -2818,14 +2818,33 @@ void SynEdit::doCutToClipboard()
{ {
if (mReadOnly) if (mReadOnly)
return; return;
if (!selAvail())
doSelecteLine();
mUndoList->BeginBlock(); mUndoList->BeginBlock();
if (!selAvail()) {
mUndoList->AddChange(
SynChangeReason::crSelection,
caretXY(),
caretXY(),
"",
SynSelectionMode::smNormal);
mUndoList->AddChange(
SynChangeReason::crCaret,
caretXY(),
caretXY(),
"",
activeSelectionMode());
doSelecteLine();
}
auto action = finally([this] { auto action = finally([this] {
mUndoList->EndBlock(); mUndoList->EndBlock();
}); });
internalDoCopyToClipboard(selText()); internalDoCopyToClipboard(selText());
doSetSelText(""); doSetSelText("");
mUndoList->AddChange(
SynChangeReason::crNothing,
BufferCoord{0,0},
BufferCoord{0,0},
"",
SynSelectionMode::smNormal);
} }
void SynEdit::doCopyToClipboard() void SynEdit::doCopyToClipboard()