diff --git a/NEWS.md b/NEWS.md index f55fc3f9..353b34de 100644 --- a/NEWS.md +++ b/NEWS.md @@ -14,6 +14,9 @@ Red Panda C++ Version 2.17 - enhancement: Syntax color support for binaray integer literals. - enhancement: Syntax color support for suffix in integer/float literals. - 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 diff --git a/RedPandaIDE/editor.cpp b/RedPandaIDE/editor.cpp index 05828788..4645256f 100644 --- a/RedPandaIDE/editor.cpp +++ b/RedPandaIDE/editor.cpp @@ -184,7 +184,7 @@ Editor::Editor(QWidget *parent, const QString& filename, setCaretPosition(1,1); mCanAutoSave = true; } - } + } if (!isNew && parentPageControl) { resetBookmarks(); resetBreakpoints(); diff --git a/libs/qsynedit/qsynedit/qsynedit.cpp b/libs/qsynedit/qsynedit/qsynedit.cpp index 81fee7af..cbbd80ff 100644 --- a/libs/qsynedit/qsynedit/qsynedit.cpp +++ b/libs/qsynedit/qsynedit/qsynedit.cpp @@ -4840,15 +4840,16 @@ void QSynEdit::moveCaretVert(int DY, bool isSelection) { DisplayCoord ptO = displayXY(); DisplayCoord ptDst = ptO; - - ptDst.Row+=DY; + if (DY >= 0) { - if (rowToLine(ptDst.Row) > mDocument->count()) + if (rowToLine(ptDst.Row) > mDocument->count()) { ptDst.Row = std::max(1, displayLineCount()); + } } else { - if (ptDst.Row < 1) + if (ptDst.Row < 1) { ptDst.Row = 1; + } } if (ptO.Row != ptDst.Row) { @@ -4863,7 +4864,17 @@ void QSynEdit::moveCaretVert(int DY, bool isSelection) 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) { QString s=mDocument->getLine(vDstLineChar.line-1);