- fix: selection calculation error when editing in column mode

This commit is contained in:
Roy Qu 2022-05-14 16:06:57 +08:00
parent 4492db3874
commit f412eedcb0
2 changed files with 14 additions and 1 deletions

View File

@ -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

View File

@ -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;