- enhancement: alt+shift+arrow do column selection

- fix: input may cause error, if selection in column mode and begin/end at the same column
  - enhancement: draw selection line if selection in column mode and begin/end at the same column
This commit is contained in:
Roy Qu 2022-03-25 12:59:53 +08:00
parent c979ef1505
commit 8b224010e0
4 changed files with 15 additions and 4 deletions

View File

@ -18,7 +18,9 @@ Red Panda C++ Version 1.0.1
- enhancement: switch capslock won't cancel code completion
- enhancement: double click on item in code completion list will use it to complete
- fix: goto declaration by ctrl+click will incorrectly select contents
- enhacement: alt+shift+arrow do column selection
- enhancement: alt+shift+arrow do column selection
- fix: input may cause error, if selection in column mode and begin/end at the same column
- enhancement: draw selection line if selection in column mode and begin/end at the same column
Red Panda C++ Version 1.0.0
- fix: calculation for code snippets's tab stop positions is not correct

View File

@ -701,6 +701,9 @@ void Editor::keyPressEvent(QKeyEvent *event)
if (t.isEmpty())
return;
if (activeSelectionMode()==SynSelectionMode::smColumn)
return;
QChar ch = t[0];
if (isIdentChar(ch)) {
mLastIdCharPressed++;

View File

@ -1037,6 +1037,11 @@ bool SynEdit::selAvail() const
((mBlockBegin.Line != mBlockEnd.Line) && (mActiveSelectionMode != SynSelectionMode::smColumn));
}
bool SynEdit::colSelAvail() const
{
return (mActiveSelectionMode == SynSelectionMode::smColumn && mBlockBegin.Line!=mBlockEnd.Line);
}
QString SynEdit::wordAtCursor()
{
return wordAtRowCol(caretXY());
@ -2917,7 +2922,7 @@ void SynEdit::doPasteFromClipboard()
blockEnd(),
selText(),
mActiveSelectionMode);
} else
} else if (!colSelAvail())
setActiveSelectionMode(selectionMode());
BufferCoord vStartOfBlock = blockBegin();
BufferCoord vEndOfBlock = blockEnd();
@ -4786,7 +4791,7 @@ void SynEdit::moveCaretVert(int DY, bool isSelection)
if (qApp->keyboardModifiers().testFlag(Qt::AltModifier))
setActiveSelectionMode(SynSelectionMode::smColumn);
else
setSelectionMode(selectionMode());
setActiveSelectionMode(selectionMode());
}
moveCaretAndSelection(mBlockBegin, vDstLineChar, isSelection);
decPaintLock();
@ -4914,7 +4919,7 @@ void SynEdit::doSetSelText(const QString &Value)
mUndoList->AddChange(
SynChangeReason::crDelete, mBlockBegin, mBlockEnd,
selText(), mActiveSelectionMode);
} else
} else if (!colSelAvail())
setActiveSelectionMode(selectionMode());
BufferCoord StartOfBlock = blockBegin();
BufferCoord EndOfBlock = blockEnd();

View File

@ -208,6 +208,7 @@ public:
void lockPainter();
void unlockPainter();
bool selAvail() const;
bool colSelAvail() const;
QString wordAtCursor();
QString wordAtRowCol(const BufferCoord& XY);