From bc86a3d8da4301ea6ce94c52715bd7cf863b0c37 Mon Sep 17 00:00:00 2001 From: MihailRis Date: Mon, 6 Oct 2025 12:46:27 +0300 Subject: [PATCH] fix incorrect textbox horizontal scroll --- src/graphics/ui/elements/TextBox.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/graphics/ui/elements/TextBox.cpp b/src/graphics/ui/elements/TextBox.cpp index a05ba5df..81732348 100644 --- a/src/graphics/ui/elements/TextBox.cpp +++ b/src/graphics/ui/elements/TextBox.cpp @@ -1211,13 +1211,12 @@ void TextBox::setCaret(size_t position) { } int lcaret = caret - rawTextCache.getTextLineOffset(line); int realoffset = - rawTextCache.metrics.calcWidth(labelText, lcaret) - static_cast(textOffset) + 2; + rawTextCache.metrics.calcWidth(labelText, 0, lcaret) - static_cast(textOffset) + 2; if (realoffset - width > 0) { setTextOffset(textOffset + realoffset - width); } else if (realoffset < 0) { - setTextOffset(std::max(textOffset + realoffset, static_cast(0)) - ); + setTextOffset(std::max(textOffset + realoffset, static_cast(0))); } }