From 66e48cbf41b8846c82094bd9870967467834a537 Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Tue, 9 Apr 2024 22:16:09 +0800 Subject: [PATCH] minor refactor --- libs/qsynedit/qsynedit/document.cpp | 4 ++-- libs/qsynedit/qsynedit/document.h | 10 +++------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/libs/qsynedit/qsynedit/document.cpp b/libs/qsynedit/qsynedit/document.cpp index ef08e905..229315dd 100644 --- a/libs/qsynedit/qsynedit/document.cpp +++ b/libs/qsynedit/qsynedit/document.cpp @@ -1334,9 +1334,9 @@ int DocumentLine::glyphWidth(int i) return calcSegmentInterval(mGlyphStartPositionList, mWidth, i); } -int DocumentLine::width(bool forceUpdate) +int DocumentLine::width() { - if(mWidth<0 || forceUpdate) + if(mWidth<0) updateWidth(); return mWidth; } diff --git a/libs/qsynedit/qsynedit/document.h b/libs/qsynedit/qsynedit/document.h index f838cefb..811f7f94 100644 --- a/libs/qsynedit/qsynedit/document.h +++ b/libs/qsynedit/qsynedit/document.h @@ -68,17 +68,13 @@ private: * * @return the glyphs count */ - int glyphsCount() const { - return mGlyphStartCharList.length(); - } + int glyphsCount() const { return mGlyphStartCharList.length(); } /** * @brief get list of start index of the glyphs in the line text * @return start indice of the glyph. */ - const QList& glyphStartCharList() const { - return mGlyphStartCharList; - } + const QList& glyphStartCharList() const { return mGlyphStartCharList; } /** * @brief get list of start position of the glyphs in the line text @@ -131,7 +127,7 @@ private: * @brief get the width (pixel) of the line text * @return the width (in width) */ - int width(bool forceUpdate=false); + int width(); /** * @brief get the state of the syntax highlighter after this line is parsed