diff --git a/NEWS.md b/NEWS.md index 9fcd3fdb..69baea76 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,6 +1,9 @@ Red Panda C++ Version 1.0.2 - enhancement: press tab in column mode won't exit column mode - enhancement: refine behavior of undo input space char + - enhancement: better display when input with IM under column mode + - enhancement: better display current lines under column mode + - change: test to use utf-8 as the default encoding (prepare to use libclang to implement parser) Red Panda C++ Version 1.0.1 - fix: only convert project icon file when it's filename doesn't end with ".ico" diff --git a/RedPandaIDE/qsynedit/SynEdit.cpp b/RedPandaIDE/qsynedit/SynEdit.cpp index 8cb332d3..948b8952 100644 --- a/RedPandaIDE/qsynedit/SynEdit.cpp +++ b/RedPandaIDE/qsynedit/SynEdit.cpp @@ -6211,7 +6211,12 @@ void SynEdit::inputMethodEvent(QInputMethodEvent *event) QString oldString = mInputPreeditString; mInputPreeditString = event->preeditString(); if (oldString!=mInputPreeditString) { - invalidateLine(mCaretY); + if (mActiveSelectionMode==SynSelectionMode::smColumn) { + BufferCoord selBegin = blockBegin(); + BufferCoord selEnd = blockEnd(); + invalidateLines(selBegin.Line,selEnd.Line); + } else + invalidateLine(mCaretY); } QString s = event->commitString(); if (!s.isEmpty()) { diff --git a/RedPandaIDE/qsynedit/TextPainter.cpp b/RedPandaIDE/qsynedit/TextPainter.cpp index 044eb5b0..a28a9213 100644 --- a/RedPandaIDE/qsynedit/TextPainter.cpp +++ b/RedPandaIDE/qsynedit/TextPainter.cpp @@ -124,12 +124,20 @@ void SynEditTextPainter::paintGutter(const QRect& clip) textColor = edit->mForegroundColor; } // draw each line if it is not hidden by a fold + BufferCoord selectionStart = edit->blockBegin(); + BufferCoord selectionEnd = edit->blockEnd(); for (int cRow = aFirstRow; cRow <= aLastRow; cRow++) { vLine = edit->rowToLine(cRow); if ((vLine > edit->mLines->count()) && (edit->mLines->count() > 0 )) break; - if (edit->mCaretY==vLine && edit->mGutter.activeLineTextColor().isValid()) { - painter->setPen(edit->mGutter.activeLineTextColor()); + if (edit->mGutter.activeLineTextColor().isValid()) { + if ( + (edit->mCaretY==vLine) || + (edit->mActiveSelectionMode == SynSelectionMode::smColumn && vLine >= selectionStart.Line && vLine <= selectionEnd.Line) + ) + painter->setPen(edit->mGutter.activeLineTextColor()); + else + painter->setPen(textColor); } else { painter->setPen(textColor); } @@ -803,6 +811,8 @@ void SynEditTextPainter::PaintLines() TokenAccu.Columns = 0; TokenAccu.ColumnsBefore = 0; // Now loop through all the lines. The indices are valid for Lines. + BufferCoord selectionBegin = edit->blockBegin(); + BufferCoord selectionEnd= edit->blockEnd(); for (cRow = aFirstRow; cRow<=aLastRow; cRow++) { vLine = edit->rowToLine(cRow); if (vLine > edit->mLines->count() && edit->mLines->count() != 0) @@ -811,7 +821,11 @@ void SynEditTextPainter::PaintLines() // Get the line. sLine = edit->mLines->getString(vLine - 1); // determine whether will be painted with ActiveLineColor - bCurrentLine = (edit->mCaretY == vLine); + if (edit->mActiveSelectionMode == SynSelectionMode::smColumn) { + bCurrentLine = (vLine >= selectionBegin.Line && vLine <= selectionEnd.Line); + } else { + bCurrentLine = (edit->mCaretY == vLine); + } if (bCurrentLine && !edit->mInputPreeditString.isEmpty()) { sLine = sLine.left(edit->mCaretX-1) + edit->mInputPreeditString + sLine.mid(edit->mCaretX-1); diff --git a/RedPandaIDE/settings.cpp b/RedPandaIDE/settings.cpp index 2710f17d..af7cd942 100644 --- a/RedPandaIDE/settings.cpp +++ b/RedPandaIDE/settings.cpp @@ -1348,7 +1348,7 @@ void Settings::Editor::doLoad() if (useUTF8ByDefault) mDefaultEncoding = ENCODING_UTF8; else - mDefaultEncoding = value("default_encoding", ENCODING_SYSTEM_DEFAULT).toByteArray(); + mDefaultEncoding = value("default_encoding", ENCODING_UTF8).toByteArray(); mAutoDetectFileEncoding = boolValue("auto_detect_file_encoding",true); mUndoLimit = intValue("undo_limit",1000);