diff options
Diffstat (limited to 'scene/gui/label.cpp')
-rw-r--r-- | scene/gui/label.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/scene/gui/label.cpp b/scene/gui/label.cpp index b7918994d8..d2e1e7f0b9 100644 --- a/scene/gui/label.cpp +++ b/scene/gui/label.cpp @@ -339,7 +339,7 @@ int Label::get_longest_line_width() const { int Label::get_line_count() const { - if (!is_inside_scene()) + if (!is_inside_tree()) return 1; if (word_cache_dirty) const_cast<Label*>(this)->regenerate_word_cache(); @@ -397,6 +397,7 @@ void Label::regenerate_word_cache() { } + if (current=='\n') { insert_newline=true; } else { @@ -446,7 +447,7 @@ void Label::regenerate_word_cache() { } - total_char_cache -= line_count + 1; // do not count new lines (including the first one) + //total_char_cache -= line_count + 1; // do not count new lines (including the first one) if (!autowrap) { @@ -535,7 +536,7 @@ void Label::set_percent_visible(float p_percent) { if (p_percent<0) set_visible_characters(-1); else - set_visible_characters(get_total_character_count()*p_percent); + set_visible_characters(get_total_character_count()*p_percent); percent_visible=p_percent; } |