streamline code

This commit is contained in:
Roy Qu 2024-04-02 22:51:59 +08:00
parent 7fedf86d4e
commit 8e81338038
3 changed files with 3 additions and 11 deletions

View File

@ -1244,14 +1244,6 @@ QList<int> Document::getGlyphStartCharList(int line, const QString &lineText)
return mLines[line]->glyphStartCharList(); return mLines[line]->glyphStartCharList();
} }
QList<int> Document::getGlyphStartPositionList(int line, const QString &lineText, int &lineWidth)
{
if (line<0 || line>=count() || mLines[line]->lineText()!=lineText)
return calcGlyphPositionList(lineText,lineWidth);
lineWidth = mLines[line]->width();
return mLines[line]->glyphStartPositionList();
}
NewlineType Document::getNewlineType() NewlineType Document::getNewlineType()
{ {
QMutexLocker locker(&mMutex); QMutexLocker locker(&mMutex);

View File

@ -595,7 +595,6 @@ private:
QList<int> calcGlyphPositionList(const QString& lineText, const QList<int> &glyphStartCharList, int left, int &right) const; QList<int> calcGlyphPositionList(const QString& lineText, const QList<int> &glyphStartCharList, int left, int &right) const;
QList<int> calcGlyphPositionList(const QString& lineText, int &width) const; QList<int> calcGlyphPositionList(const QString& lineText, int &width) const;
QList<int> getGlyphStartCharList(int line, const QString &lineText); QList<int> getGlyphStartCharList(int line, const QString &lineText);
QList<int> getGlyphStartPositionList(int line, const QString &lineText, int &lineWidth);
bool tryLoadFileByEncoding(QByteArray encodingName, QFile& file); bool tryLoadFileByEncoding(QByteArray encodingName, QFile& file);
void loadUTF16BOMFile(QFile& file); void loadUTF16BOMFile(QFile& file);
void loadUTF32BOMFile(QFile& file); void loadUTF32BOMFile(QFile& file);

View File

@ -1036,9 +1036,10 @@ void QSynEditPainter::paintLines()
mRcToken = mRcLine; mRcToken = mRcLine;
int lineWidth;
QList<int> glyphStartCharList = mEdit->mDocument->getGlyphStartCharList(vLine-1,sLine); QList<int> glyphStartCharList = mEdit->mDocument->getGlyphStartCharList(vLine-1,sLine);
QList<int> glyphStartPositionsList = mEdit->mDocument->getGlyphStartPositionList(vLine-1,sLine, lineWidth); // Ensure the list has the right number of elements.
// Values in it doesn't matter, we'll recalculate them.
QList<int> glyphStartPositionsList = glyphStartCharList;
// Initialize highlighter with line text and range info. It is // Initialize highlighter with line text and range info. It is
// necessary because we probably did not scan to the end of the last // necessary because we probably did not scan to the end of the last
// line - the internal highlighter range might be wrong. // line - the internal highlighter range might be wrong.