- 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)
This commit is contained in:
Roy Qu 2022-03-26 19:10:14 +08:00
parent 3ba5811edf
commit 7c218b7d5a
4 changed files with 27 additions and 5 deletions

View File

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

View File

@ -6211,6 +6211,11 @@ void SynEdit::inputMethodEvent(QInputMethodEvent *event)
QString oldString = mInputPreeditString;
mInputPreeditString = event->preeditString();
if (oldString!=mInputPreeditString) {
if (mActiveSelectionMode==SynSelectionMode::smColumn) {
BufferCoord selBegin = blockBegin();
BufferCoord selEnd = blockEnd();
invalidateLines(selBegin.Line,selEnd.Line);
} else
invalidateLine(mCaretY);
}
QString s = event->commitString();

View File

@ -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()) {
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
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);

View File

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