summaryrefslogtreecommitdiff
path: root/scene/gui
diff options
context:
space:
mode:
authorPouleyKetchoupp <pouleyketchoup@gmail.com>2019-10-14 18:51:07 +0200
committerPouleyKetchoupp <pouleyketchoup@gmail.com>2019-10-16 09:57:44 +0200
commit8df330bacd61529d7d985ac0a038205cdc94b064 (patch)
tree9acfd26937f698cc51fde9df9cef21a6523b4ead /scene/gui
parent26bbb26738ec94d2f74ad866b79e5f44ca62ca75 (diff)
Allow Label autowrap to cut words when they exceed line width
Fixes #30832
Diffstat (limited to 'scene/gui')
-rw-r--r--scene/gui/label.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/scene/gui/label.cpp b/scene/gui/label.cpp
index 510f1b18ad..4edd4b8530 100644
--- a/scene/gui/label.cpp
+++ b/scene/gui/label.cpp
@@ -452,6 +452,11 @@ void Label::regenerate_word_cache() {
current_word_size += char_width;
line_width += char_width;
total_char_cache++;
+
+ // allow autowrap to cut words when they exceed line width
+ if (autowrap && (current_word_size > width)) {
+ separatable = true;
+ }
}
if ((autowrap && (line_width >= width) && ((last && last->char_pos >= 0) || separatable)) || insert_newline) {