From a4ba3d5bed0dce4ffa016aa8bce0a254aac34654 Mon Sep 17 00:00:00 2001 From: TelePete <5140047+TelePete@users.noreply.github.com> Date: Mon, 9 Jun 2025 23:38:38 +0200 Subject: [PATCH] Fix visible ratio when displaying all characters in Label --- scene/gui/label.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scene/gui/label.cpp b/scene/gui/label.cpp index d71c4f614e..d0b4c92acb 100644 --- a/scene/gui/label.cpp +++ b/scene/gui/label.cpp @@ -1269,10 +1269,10 @@ String Label::get_text() const { void Label::set_visible_characters(int p_amount) { if (visible_chars != p_amount) { visible_chars = p_amount; - if (get_total_character_count() > 0) { - visible_ratio = (float)p_amount / (float)get_total_character_count(); - } else { + if (p_amount == -1 || get_total_character_count() == 0) { visible_ratio = 1.0; + } else { + visible_ratio = (float)p_amount / (float)get_total_character_count(); } if (visible_chars_behavior == TextServer::VC_CHARS_BEFORE_SHAPING) { text_dirty = true;