- fix: index of the longest line not correctly updated when inputting with auto completion open

This commit is contained in:
Roy Qu 2022-05-04 00:08:04 +08:00
parent 45744b43f0
commit cd4bfdfa23
4 changed files with 11 additions and 6 deletions

View File

@ -4,6 +4,7 @@ Red Panda C++ Version 1.0.7
- enhancement: don't highlight '\' as error - 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 - 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: 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 Red Panda C++ Version 1.0.6
- fix: gcc compiler set name is not correct in Linux - fix: gcc compiler set name is not correct in Linux

View File

@ -1131,7 +1131,7 @@ QChar SynEdit::lastNonSpaceChar(int line, int ch)
return QChar(); 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; SynSelectionMode vOldMode = mActiveSelectionMode;
incPaintLock(); incPaintLock();
@ -1140,8 +1140,8 @@ void SynEdit::setCaretAndSelection(const BufferCoord &ptCaret, const BufferCoord
decPaintLock(); decPaintLock();
}); });
internalSetCaretXY(ptCaret); internalSetCaretXY(ptCaret);
setBlockBegin(ptBefore); setBlockBegin(ptSelBegin);
setBlockEnd(ptAfter); setBlockEnd(ptSelEnd);
} }
bool SynEdit::inputMethodOn() bool SynEdit::inputMethodOn()

View File

@ -238,8 +238,8 @@ public:
void setCaretXYEx(bool CallEnsureCursorPosVisible, BufferCoord value); void setCaretXYEx(bool CallEnsureCursorPosVisible, BufferCoord value);
void setCaretXYCentered(const BufferCoord& value); void setCaretXYCentered(const BufferCoord& value);
void setCaretAndSelection(const BufferCoord& ptCaret, void setCaretAndSelection(const BufferCoord& ptCaret,
const BufferCoord& ptBefore, const BufferCoord& ptSelBegin,
const BufferCoord& ptAfter); const BufferCoord& ptSelEnd);
bool inputMethodOn(); bool inputMethodOn();

View File

@ -439,8 +439,12 @@ void SynDocument::putString(int Index, const QString &s, bool notify) {
int oldColumns = mLines[Index]->fColumns; int oldColumns = mLines[Index]->fColumns;
mLines[Index]->fString = s; mLines[Index]->fString = s;
calculateLineColumns(Index); calculateLineColumns(Index);
if (oldColumns>mLines[Index]->fColumns) if (mIndexOfLongestLine == Index && oldColumns>mLines[Index]->fColumns )
mIndexOfLongestLine = -1; mIndexOfLongestLine = -1;
else if (mIndexOfLongestLine>=0
&& mIndexOfLongestLine<mLines.count()
&& mLines[Index]->fColumns > mLines[mIndexOfLongestLine]->fColumns)
mIndexOfLongestLine = Index;
if (notify) if (notify)
emit putted(Index,1); emit putted(Index,1);
endUpdate(); endUpdate();