minor refactor

This commit is contained in:
Roy Qu 2024-02-26 10:38:02 +08:00
parent d648e741df
commit b3b5affeb8
3 changed files with 8 additions and 8 deletions

View File

@ -1255,10 +1255,10 @@ void QSynEditPainter::paintLines()
} }
areaList.append(area); areaList.append(area);
mEdit->mGlyphPostionListCache.str = sLine; mEdit->mGlyphPostionCacheForInputMethod.str = sLine;
mEdit->mGlyphPostionListCache.glyphCharList = glyphStartCharList; mEdit->mGlyphPostionCacheForInputMethod.glyphCharList = glyphStartCharList;
mEdit->mGlyphPostionListCache.glyphPositionList = glyphStartPositionsList; mEdit->mGlyphPostionCacheForInputMethod.glyphPositionList = glyphStartPositionsList;
mEdit->mGlyphPostionListCache.strWidth = tokenLeft; mEdit->mGlyphPostionCacheForInputMethod.strWidth = tokenLeft;
} }
paintEditAreas(areaList); paintEditAreas(areaList);
} }

View File

@ -2503,9 +2503,9 @@ QRect QSynEdit::calculateCaretRect() const
QString sLine = lineText().left(mCaretX-1) QString sLine = lineText().left(mCaretX-1)
+ mInputPreeditString + mInputPreeditString
+ lineText().mid(mCaretX-1); + lineText().mid(mCaretX-1);
if (sLine == mGlyphPostionListCache.str) { if (sLine == mGlyphPostionCacheForInputMethod.str) {
int glyphIdx = searchForSegmentIdx(mGlyphPostionListCache.glyphCharList,0,sLine.length(),mCaretX+mInputPreeditString.length()-1); int glyphIdx = searchForSegmentIdx(mGlyphPostionCacheForInputMethod.glyphCharList,0,sLine.length(),mCaretX+mInputPreeditString.length()-1);
coord.x = segmentIntervalStart(mGlyphPostionListCache.glyphPositionList,0,mGlyphPostionListCache.strWidth, glyphIdx); coord.x = segmentIntervalStart(mGlyphPostionCacheForInputMethod.glyphPositionList,0,mGlyphPostionCacheForInputMethod.strWidth, glyphIdx);
} else } else
coord.x = charToGlyphLeft(mCaretY, sLine, mCaretX+mInputPreeditString.length()); coord.x = charToGlyphLeft(mCaretY, sLine, mCaretX+mInputPreeditString.length());
} }

View File

@ -779,7 +779,7 @@ private:
int mWheelAccumulatedDeltaY; int mWheelAccumulatedDeltaY;
PFormatter mFormatter; PFormatter mFormatter;
GlyphPostionsListCache mGlyphPostionListCache; GlyphPostionsListCache mGlyphPostionCacheForInputMethod;
friend class QSynEditPainter; friend class QSynEditPainter;