- fix: selection in column mode not correctly drawn when has wide chars in it

This commit is contained in:
Roy Qu 2022-05-18 15:52:19 +08:00
parent c56a020781
commit e1ac7cafb0
3 changed files with 16 additions and 19 deletions

View File

@ -9,6 +9,8 @@ Red Panda C++ Version 1.0.8
- enhancement: adjust scheme colors for "dark" and "high contrast" themes
- enhancement: can debug files that has non-ascii chars in its path and is compiled by clang
- fix: when debugging project, default compiler set is wrongly used
- fix: selection in column mode not correctly drawn when has wide char in it
Red Panda C++ Version 1.0.7
- change: use Shift+Enter to break line

View File

@ -6625,13 +6625,6 @@ 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;
@ -6723,12 +6716,6 @@ 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;

View File

@ -859,21 +859,29 @@ void SynEditTextPainter::PaintLines()
nLineSelEnd = LastCol + 1;
if ((edit->mActiveSelectionMode == SynSelectionMode::smColumn) ||
((edit->mActiveSelectionMode == SynSelectionMode::smNormal) && (cRow == vSelStart.Row)) ) {
if (vSelStart.Column > LastCol) {
int ch = edit->columnToChar(vLine,vSelStart.Column);
qDebug()<<"-1-"<<vLine<<ch;
ch = edit->charToColumn(vLine,ch);
qDebug()<<"-2-"<<vLine<<ch;
if (ch > LastCol) {
nLineSelStart = 0;
nLineSelEnd = 0;
} else if (vSelStart.Column > FirstCol) {
nLineSelStart = vSelStart.Column;
} else if (ch > FirstCol) {
nLineSelStart = ch;
bComplexLine = true;
}
}
if ( (edit->mActiveSelectionMode == SynSelectionMode::smColumn) ||
((edit->mActiveSelectionMode == SynSelectionMode::smNormal) && (cRow == vSelEnd.Row)) ) {
if (vSelEnd.Column < FirstCol) {
int ch = edit->columnToChar(vLine,vSelEnd.Column);
int col = edit->charToColumn(vLine,ch);
if (col<vSelEnd.Column)
col = edit->charToColumn(vLine,ch+1);
if (col < FirstCol) {
nLineSelStart = 0;
nLineSelEnd = 0;
} else if (vSelEnd.Column < LastCol) {
nLineSelEnd = vSelEnd.Column;
} else if (col < LastCol) {
nLineSelEnd = col;
bComplexLine = true;
}
}