- enhancement: refine behavior of undo input space char
This commit is contained in:
parent
225eb1961a
commit
3ba5811edf
1
NEWS.md
1
NEWS.md
|
@ -1,5 +1,6 @@
|
||||||
Red Panda C++ Version 1.0.2
|
Red Panda C++ Version 1.0.2
|
||||||
- enhancement: press tab in column mode won't exit column mode
|
- enhancement: press tab in column mode won't exit column mode
|
||||||
|
- enhancement: refine behavior of undo input space char
|
||||||
|
|
||||||
Red Panda C++ Version 1.0.1
|
Red Panda C++ Version 1.0.1
|
||||||
- fix: only convert project icon file when it's filename doesn't end with ".ico"
|
- fix: only convert project icon file when it's filename doesn't end with ".ico"
|
||||||
|
|
|
@ -2786,9 +2786,6 @@ void SynEdit::doAddChar(QChar AChar)
|
||||||
setSelLength(1);
|
setSelLength(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool addInColumnMode = (mActiveSelectionMode == SynSelectionMode::smColumn);
|
|
||||||
BufferCoord oldBlockBegin = blockBegin();
|
|
||||||
BufferCoord oldBlockEnd = blockEnd();
|
|
||||||
if (isIdentChar(AChar)) {
|
if (isIdentChar(AChar)) {
|
||||||
doSetSelText(AChar);
|
doSetSelText(AChar);
|
||||||
} else if (AChar.isSpace()) {
|
} else if (AChar.isSpace()) {
|
||||||
|
@ -2799,10 +2796,11 @@ void SynEdit::doAddChar(QChar AChar)
|
||||||
"", SynSelectionMode::smNormal);
|
"", SynSelectionMode::smNormal);
|
||||||
doSetSelText(AChar);
|
doSetSelText(AChar);
|
||||||
// break group undo chain
|
// break group undo chain
|
||||||
mUndoList->AddChange(SynChangeReason::crNothing,
|
// if (mActiveSelectionMode!=SynSelectionMode::smColumn)
|
||||||
BufferCoord{0, 0},
|
// mUndoList->AddChange(SynChangeReason::crNothing,
|
||||||
BufferCoord{0, 0},
|
// BufferCoord{0, 0},
|
||||||
"", SynSelectionMode::smNormal);
|
// BufferCoord{0, 0},
|
||||||
|
// "", SynSelectionMode::smNormal);
|
||||||
}else {
|
}else {
|
||||||
mUndoList->BeginBlock();
|
mUndoList->BeginBlock();
|
||||||
doSetSelText(AChar);
|
doSetSelText(AChar);
|
||||||
|
@ -2877,13 +2875,6 @@ void SynEdit::doAddChar(QChar AChar)
|
||||||
}
|
}
|
||||||
mUndoList->EndBlock();
|
mUndoList->EndBlock();
|
||||||
}
|
}
|
||||||
if (addInColumnMode) {
|
|
||||||
oldBlockBegin.Char = mCaretX;
|
|
||||||
oldBlockEnd.Char = mCaretX;
|
|
||||||
setBlockBegin(oldBlockBegin);
|
|
||||||
setBlockEnd(oldBlockEnd);
|
|
||||||
setActiveSelectionMode(SynSelectionMode::smColumn);
|
|
||||||
}
|
|
||||||
//DoOnPaintTransient(ttAfter);
|
//DoOnPaintTransient(ttAfter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4170,17 +4161,7 @@ void SynEdit::doAddStr(const QString &s)
|
||||||
setCaretAndSelection(caretXY(),BB,BE);
|
setCaretAndSelection(caretXY(),BB,BE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bool addInColumnMode = (mActiveSelectionMode == SynSelectionMode::smColumn);
|
|
||||||
BufferCoord oldBlockBegin = blockBegin();
|
|
||||||
BufferCoord oldBlockEnd = blockEnd();
|
|
||||||
doSetSelText(s);
|
doSetSelText(s);
|
||||||
if (addInColumnMode) {
|
|
||||||
oldBlockBegin.Char = mCaretX;
|
|
||||||
oldBlockEnd.Char = mCaretX;
|
|
||||||
setBlockBegin(oldBlockBegin);
|
|
||||||
setBlockEnd(oldBlockEnd);
|
|
||||||
setActiveSelectionMode(SynSelectionMode::smColumn);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynEdit::doUndo()
|
void SynEdit::doUndo()
|
||||||
|
@ -4199,13 +4180,6 @@ void SynEdit::doUndo()
|
||||||
mRedoList->AddGroupBreak();
|
mRedoList->AddGroupBreak();
|
||||||
}
|
}
|
||||||
|
|
||||||
SynChangeReason FLastChange = mUndoList->LastChangeReason();
|
|
||||||
bool FAutoComplete = (FLastChange == SynChangeReason::crAutoCompleteEnd);
|
|
||||||
bool FPasteAction = (FLastChange == SynChangeReason::crPasteEnd);
|
|
||||||
bool FSpecial1 = (FLastChange == SynChangeReason::crSpecial1End);
|
|
||||||
bool FSpecial2 = (FLastChange == SynChangeReason::crSpecial2End);
|
|
||||||
bool FKeepGoing;
|
|
||||||
|
|
||||||
PSynEditUndoItem Item = mUndoList->PeekItem();
|
PSynEditUndoItem Item = mUndoList->PeekItem();
|
||||||
if (Item) {
|
if (Item) {
|
||||||
int OldChangeNumber = Item->changeNumber();
|
int OldChangeNumber = Item->changeNumber();
|
||||||
|
@ -4221,6 +4195,12 @@ void SynEdit::doUndo()
|
||||||
doUndoItem();
|
doUndoItem();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
SynChangeReason FLastChange = mUndoList->LastChangeReason();
|
||||||
|
bool FAutoComplete = (FLastChange == SynChangeReason::crAutoCompleteEnd);
|
||||||
|
bool FPasteAction = (FLastChange == SynChangeReason::crPasteEnd);
|
||||||
|
bool FSpecial1 = (FLastChange == SynChangeReason::crSpecial1End);
|
||||||
|
bool FSpecial2 = (FLastChange == SynChangeReason::crSpecial2End);
|
||||||
|
bool FKeepGoing;
|
||||||
do {
|
do {
|
||||||
doUndoItem();
|
doUndoItem();
|
||||||
Item = mUndoList->PeekItem();
|
Item = mUndoList->PeekItem();
|
||||||
|
@ -4431,12 +4411,6 @@ void SynEdit::doRedo()
|
||||||
if (mReadOnly)
|
if (mReadOnly)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SynChangeReason FLastChange = mRedoList->LastChangeReason();
|
|
||||||
bool FAutoComplete = (FLastChange == SynChangeReason::crAutoCompleteBegin);
|
|
||||||
bool FPasteAction = (FLastChange == SynChangeReason::crPasteBegin);
|
|
||||||
bool FSpecial1 = (FLastChange == SynChangeReason::crSpecial1Begin);
|
|
||||||
bool FSpecial2 = (FLastChange == SynChangeReason::crSpecial2Begin);
|
|
||||||
|
|
||||||
PSynEditUndoItem Item = mRedoList->PeekItem();
|
PSynEditUndoItem Item = mRedoList->PeekItem();
|
||||||
if (!Item)
|
if (!Item)
|
||||||
return;
|
return;
|
||||||
|
@ -4453,6 +4427,11 @@ void SynEdit::doRedo()
|
||||||
doRedoItem();
|
doRedoItem();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
SynChangeReason FLastChange = mRedoList->LastChangeReason();
|
||||||
|
bool FAutoComplete = (FLastChange == SynChangeReason::crAutoCompleteBegin);
|
||||||
|
bool FPasteAction = (FLastChange == SynChangeReason::crPasteBegin);
|
||||||
|
bool FSpecial1 = (FLastChange == SynChangeReason::crSpecial1Begin);
|
||||||
|
bool FSpecial2 = (FLastChange == SynChangeReason::crSpecial2Begin);
|
||||||
bool FKeepGoing;
|
bool FKeepGoing;
|
||||||
do {
|
do {
|
||||||
doRedoItem();
|
doRedoItem();
|
||||||
|
@ -4976,11 +4955,6 @@ void SynEdit::setSelTextPrimitiveEx(SynSelectionMode PasteMode, const QString &V
|
||||||
BufferCoord BE = blockEnd();
|
BufferCoord BE = blockEnd();
|
||||||
if (selAvail()) {
|
if (selAvail()) {
|
||||||
deleteSelection(BB,BE);
|
deleteSelection(BB,BE);
|
||||||
if (mActiveSelectionMode == SynSelectionMode::smColumn) {
|
|
||||||
BE.Char = BB.Char;
|
|
||||||
mBlockBegin = BB;
|
|
||||||
mBlockEnd = BE;
|
|
||||||
}
|
|
||||||
internalSetCaretXY(BB);
|
internalSetCaretXY(BB);
|
||||||
}
|
}
|
||||||
if (!Value.isEmpty()) {
|
if (!Value.isEmpty()) {
|
||||||
|
@ -6478,9 +6452,18 @@ void SynEdit::onLinesChanged()
|
||||||
mStateFlags.setFlag(SynStateFlag::sfLinesChanging, false);
|
mStateFlags.setFlag(SynStateFlag::sfLinesChanging, false);
|
||||||
|
|
||||||
updateScrollbars();
|
updateScrollbars();
|
||||||
|
if (mActiveSelectionMode == SynSelectionMode::smColumn) {
|
||||||
|
BufferCoord oldBlockStart = blockBegin();
|
||||||
|
BufferCoord oldBlockEnd = blockEnd();
|
||||||
|
oldBlockStart.Char = mCaretX;
|
||||||
|
oldBlockEnd.Char = mCaretX;
|
||||||
|
setBlockBegin(oldBlockStart);
|
||||||
|
setBlockEnd(oldBlockEnd);
|
||||||
|
} else {
|
||||||
vOldMode = mActiveSelectionMode;
|
vOldMode = mActiveSelectionMode;
|
||||||
setBlockBegin(caretXY());
|
setBlockBegin(caretXY());
|
||||||
mActiveSelectionMode = vOldMode;
|
mActiveSelectionMode = vOldMode;
|
||||||
|
}
|
||||||
if (mInvalidateRect.width()==0)
|
if (mInvalidateRect.width()==0)
|
||||||
invalidate();
|
invalidate();
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue