From cd4bfdfa232f3db9721d6865eb2a419977dec30e Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Wed, 4 May 2022 00:08:04 +0800 Subject: [PATCH] - fix: index of the longest line not correctly updated when inputting with auto completion open --- NEWS.md | 1 + RedPandaIDE/qsynedit/SynEdit.cpp | 6 +++--- RedPandaIDE/qsynedit/SynEdit.h | 4 ++-- RedPandaIDE/qsynedit/TextBuffer.cpp | 6 +++++- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/NEWS.md b/NEWS.md index e2a18de5..afff6768 100644 --- a/NEWS.md +++ b/NEWS.md @@ -4,6 +4,7 @@ Red Panda C++ Version 1.0.7 - enhancement: don't highlight '\' as error - enhancement: hide add charset option in project options dialog's compiler set page, when project compiler set is clang - fix: When generating project's makefile for clang, don't add -fexec-charset / -finput-charset command line options + - fix: index of the longest line not correctly updated when inputting with auto completion open Red Panda C++ Version 1.0.6 - fix: gcc compiler set name is not correct in Linux diff --git a/RedPandaIDE/qsynedit/SynEdit.cpp b/RedPandaIDE/qsynedit/SynEdit.cpp index d1891fa0..6aaad345 100644 --- a/RedPandaIDE/qsynedit/SynEdit.cpp +++ b/RedPandaIDE/qsynedit/SynEdit.cpp @@ -1131,7 +1131,7 @@ QChar SynEdit::lastNonSpaceChar(int line, int ch) return QChar(); } -void SynEdit::setCaretAndSelection(const BufferCoord &ptCaret, const BufferCoord &ptBefore, const BufferCoord &ptAfter) +void SynEdit::setCaretAndSelection(const BufferCoord &ptCaret, const BufferCoord &ptSelBegin, const BufferCoord &ptSelEnd) { SynSelectionMode vOldMode = mActiveSelectionMode; incPaintLock(); @@ -1140,8 +1140,8 @@ void SynEdit::setCaretAndSelection(const BufferCoord &ptCaret, const BufferCoord decPaintLock(); }); internalSetCaretXY(ptCaret); - setBlockBegin(ptBefore); - setBlockEnd(ptAfter); + setBlockBegin(ptSelBegin); + setBlockEnd(ptSelEnd); } bool SynEdit::inputMethodOn() diff --git a/RedPandaIDE/qsynedit/SynEdit.h b/RedPandaIDE/qsynedit/SynEdit.h index 31d9967c..8106a728 100644 --- a/RedPandaIDE/qsynedit/SynEdit.h +++ b/RedPandaIDE/qsynedit/SynEdit.h @@ -238,8 +238,8 @@ public: void setCaretXYEx(bool CallEnsureCursorPosVisible, BufferCoord value); void setCaretXYCentered(const BufferCoord& value); void setCaretAndSelection(const BufferCoord& ptCaret, - const BufferCoord& ptBefore, - const BufferCoord& ptAfter); + const BufferCoord& ptSelBegin, + const BufferCoord& ptSelEnd); bool inputMethodOn(); diff --git a/RedPandaIDE/qsynedit/TextBuffer.cpp b/RedPandaIDE/qsynedit/TextBuffer.cpp index 28d87d28..b21297b4 100644 --- a/RedPandaIDE/qsynedit/TextBuffer.cpp +++ b/RedPandaIDE/qsynedit/TextBuffer.cpp @@ -439,8 +439,12 @@ void SynDocument::putString(int Index, const QString &s, bool notify) { int oldColumns = mLines[Index]->fColumns; mLines[Index]->fString = s; calculateLineColumns(Index); - if (oldColumns>mLines[Index]->fColumns) + if (mIndexOfLongestLine == Index && oldColumns>mLines[Index]->fColumns ) mIndexOfLongestLine = -1; + else if (mIndexOfLongestLine>=0 + && mIndexOfLongestLinefColumns > mLines[mIndexOfLongestLine]->fColumns) + mIndexOfLongestLine = Index; if (notify) emit putted(Index,1); endUpdate();