diff --git a/NEWS.md b/NEWS.md index 85235333..b955de0e 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,6 +1,7 @@ Red Panda C++ Version 1.0.8 - enhancement: auto complete '#undef' - enhancement: redesign components for compiler commandline arguments processing + - fix: selection calculation error when editing in column mode Red Panda C++ Version 1.0.7 - change: use Shift+Enter to break line diff --git a/RedPandaIDE/qsynedit/SynEdit.cpp b/RedPandaIDE/qsynedit/SynEdit.cpp index 6aaad345..f408a50e 100644 --- a/RedPandaIDE/qsynedit/SynEdit.cpp +++ b/RedPandaIDE/qsynedit/SynEdit.cpp @@ -6625,12 +6625,18 @@ void SynEdit::setActiveSelectionMode(const SynSelectionMode &Value) BufferCoord SynEdit::blockEnd() const { + if (mActiveSelectionMode == SynSelectionMode::smColumn) { + return BufferCoord{ + std::max(mBlockBegin.Char,mBlockEnd.Char), + std::max(mBlockBegin.Line,mBlockEnd.Line), + }; + } + if ((mBlockEnd.Line < mBlockBegin.Line) || ((mBlockEnd.Line == mBlockBegin.Line) && (mBlockEnd.Char < mBlockBegin.Char))) return mBlockBegin; else return mBlockEnd; - } void SynEdit::setBlockEnd(BufferCoord Value) @@ -6717,6 +6723,12 @@ void SynEdit::setSelText(const QString &text) BufferCoord SynEdit::blockBegin() const { + if (mActiveSelectionMode == SynSelectionMode::smColumn) { + return BufferCoord{ + std::min(mBlockBegin.Char,mBlockEnd.Char), + std::min(mBlockBegin.Line,mBlockEnd.Line), + }; + } if ((mBlockEnd.Line < mBlockBegin.Line) || ((mBlockEnd.Line == mBlockBegin.Line) && (mBlockEnd.Char < mBlockBegin.Char))) return mBlockEnd;