From 1c6ea88be12dd38a9d47fc910d292e7cf32e2d0d Mon Sep 17 00:00:00 2001 From: scheffle Date: Mon, 21 Oct 2024 10:40:58 +0200 Subject: [PATCH] remove code duplicate --- vstgui/lib/ctexteditor.cpp | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/vstgui/lib/ctexteditor.cpp b/vstgui/lib/ctexteditor.cpp index 917e6f18a..aa06b1599 100644 --- a/vstgui/lib/ctexteditor.cpp +++ b/vstgui/lib/ctexteditor.cpp @@ -1717,14 +1717,14 @@ void TextEditorView::layout (StbTexteditRow* row, size_t start_i) const return; if (md.stbInternalIterator == md.model.lines.end ()) md.stbInternalIterator = md.model.lines.begin (); + row->baseline_y_delta = static_cast (md.lineHeight); + row->ymin = static_cast (-md.fontDescent); + row->ymax = static_cast (md.lineHeight); + row->x0 = static_cast (md.style->leftMargin); + row->x1 = static_cast (getWidth ()); if (start_i == md.stbInternalIterator->range.start) { row->num_chars = static_cast (md.stbInternalIterator->range.length); - row->baseline_y_delta = static_cast (md.lineHeight); - row->ymin = static_cast (-md.fontDescent); - row->ymax = static_cast (md.lineHeight); - row->x0 = static_cast (md.style->leftMargin); - row->x1 = static_cast (getWidth ()); ++md.stbInternalIterator; return; } @@ -1732,11 +1732,6 @@ void TextEditorView::layout (StbTexteditRow* row, size_t start_i) const auto line = findLine (md.model.lines.begin (), md.model.lines.end (), start_i); vstgui_assert (line != md.model.lines.end ()); row->num_chars = static_cast (line->range.length); - row->baseline_y_delta = static_cast (md.lineHeight); - row->ymin = static_cast (-md.fontDescent); - row->ymax = static_cast (md.lineHeight); - row->x0 = static_cast (md.style->leftMargin); - row->x1 = static_cast (getWidth ()); } //------------------------------------------------------------------------