Skip to content

Commit

Permalink
do not calculate the line width when the line does not change
Browse files Browse the repository at this point in the history
  • Loading branch information
scheffle committed Feb 25, 2024
1 parent bce155b commit c77b851
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions vstgui/lib/ctexteditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1236,8 +1236,12 @@ void TextEditorView::invalidate (Dirty what) const
//------------------------------------------------------------------------
CCoord TextEditorView::updateLineText (Lines::iterator& line) const
{
line->text = convert (md.model.text.data () + line->range.start, line->range.length);
line->width = md.fontPainer->getStringWidth (nullptr, line->text.getPlatformString ());
auto newText = convert (md.model.text.data () + line->range.start, line->range.length);
if (newText != line->text)
{
line->text = std::move (newText);
line->width = md.fontPainer->getStringWidth (nullptr, line->text.getPlatformString ());
}
return line->width;
}

Expand Down

0 comments on commit c77b851

Please sign in to comment.