- enhancement: Shift+Up in the first line will expand selection to the beginning of the line.

- enhancement: Shift+Down in the last line will expand selection to the end of the line.
This commit is contained in:
Roy Qu 2023-03-09 10:33:37 +08:00
parent 139a6d14c0
commit 79b3f91006
3 changed files with 20 additions and 6 deletions

View File

@ -14,6 +14,9 @@ Red Panda C++ Version 2.17
- enhancement: Syntax color support for binaray integer literals. - enhancement: Syntax color support for binaray integer literals.
- enhancement: Syntax color support for suffix in integer/float literals. - enhancement: Syntax color support for suffix in integer/float literals.
- fix: Cpu info window is auto openned, when debug using gdb-server. - fix: Cpu info window is auto openned, when debug using gdb-server.
- enhancement: Shift+Up in the first line will expand selection to the beginning of the line.
- enhancement: Shift+Down in the last line will expand selection to the end of the line.
Red Panda C++ Version 2.16 Red Panda C++ Version 2.16

View File

@ -184,7 +184,7 @@ Editor::Editor(QWidget *parent, const QString& filename,
setCaretPosition(1,1); setCaretPosition(1,1);
mCanAutoSave = true; mCanAutoSave = true;
} }
} }
if (!isNew && parentPageControl) { if (!isNew && parentPageControl) {
resetBookmarks(); resetBookmarks();
resetBreakpoints(); resetBreakpoints();

View File

@ -4840,15 +4840,16 @@ void QSynEdit::moveCaretVert(int DY, bool isSelection)
{ {
DisplayCoord ptO = displayXY(); DisplayCoord ptO = displayXY();
DisplayCoord ptDst = ptO; DisplayCoord ptDst = ptO;
ptDst.Row+=DY; ptDst.Row+=DY;
if (DY >= 0) { if (DY >= 0) {
if (rowToLine(ptDst.Row) > mDocument->count()) if (rowToLine(ptDst.Row) > mDocument->count()) {
ptDst.Row = std::max(1, displayLineCount()); ptDst.Row = std::max(1, displayLineCount());
}
} else { } else {
if (ptDst.Row < 1) if (ptDst.Row < 1) {
ptDst.Row = 1; ptDst.Row = 1;
}
} }
if (ptO.Row != ptDst.Row) { if (ptO.Row != ptDst.Row) {
@ -4863,7 +4864,17 @@ void QSynEdit::moveCaretVert(int DY, bool isSelection)
setActiveSelectionMode(SelectionMode::Normal); setActiveSelectionMode(SelectionMode::Normal);
} }
BufferCoord vDstLineChar = displayToBufferPos(ptDst); BufferCoord vDstLineChar;
if (ptDst.Row == ptO.Row && isSelection && DY!=0) {
if (ptDst.Row==1) {
vDstLineChar.ch=1;
vDstLineChar.line=1;
} else {
vDstLineChar.line = mDocument->count();
vDstLineChar.ch = mDocument->getLine(vDstLineChar.line-1).length()+1;
}
} else
vDstLineChar = displayToBufferPos(ptDst);
if (mActiveSelectionMode==SelectionMode::Column) { if (mActiveSelectionMode==SelectionMode::Column) {
QString s=mDocument->getLine(vDstLineChar.line-1); QString s=mDocument->getLine(vDstLineChar.line-1);