diff --git a/NEWS.md b/NEWS.md index 90a5af9d..b9dd5ccd 100644 --- a/NEWS.md +++ b/NEWS.md @@ -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 diff --git a/RedPandaIDE/qsynedit/SynEdit.cpp b/RedPandaIDE/qsynedit/SynEdit.cpp index f408a50e..b494b0b2 100644 --- a/RedPandaIDE/qsynedit/SynEdit.cpp +++ b/RedPandaIDE/qsynedit/SynEdit.cpp @@ -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; diff --git a/RedPandaIDE/qsynedit/TextPainter.cpp b/RedPandaIDE/qsynedit/TextPainter.cpp index 726d1a9f..2591f555 100644 --- a/RedPandaIDE/qsynedit/TextPainter.cpp +++ b/RedPandaIDE/qsynedit/TextPainter.cpp @@ -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-"<charToColumn(vLine,ch); + qDebug()<<"-2-"< 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 (colcharToColumn(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; } }