summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-10-22 12:29:49 +0200
committerGitHub <noreply@github.com>2019-10-22 12:29:49 +0200
commit1e0fb0dc144ce8b7daaa783a67b17c85bba5d57d (patch)
treec87ea1141b6674f307f5f60d3bb6aefdfbf1e9b9 /scene
parenta2871cc06b4acaf9b0f4a5e4cd4c99bc826ab059 (diff)
parent8df330bacd61529d7d985ac0a038205cdc94b064 (diff)
Merge pull request #32833 from nekomatata/label-autowrap-fix
Allow Label autowrap to cut words when they exceed line width
Diffstat (limited to 'scene')
-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) {