You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-17 14:11:06 +00:00
Fixed #59985 leading spaces autowrap boundary problem
Bug problem: No condition for when the first character of the label is a space character Fix: Added an IF condition for when the first character is a space character The autowrap boundary treat this space character as another dummy word in the WordCache linked list and proceed to function normally, by detecting when line width is 0
This commit is contained in:
@@ -452,7 +452,13 @@ void Label::regenerate_word_cache() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (i < xl_text.length() && xl_text[i] == ' ') {
|
if (i < xl_text.length() && xl_text[i] == ' ') {
|
||||||
if (line_width > 0 || last == nullptr || last->char_pos != WordCache::CHAR_WRAPLINE) {
|
if (line_width == 0) {
|
||||||
|
if (current_word_size == 0) {
|
||||||
|
word_pos = i;
|
||||||
|
}
|
||||||
|
current_word_size += space_width;
|
||||||
|
line_width += space_width;
|
||||||
|
} else if (line_width > 0 || last == nullptr || last->char_pos != WordCache::CHAR_WRAPLINE) {
|
||||||
space_count++;
|
space_count++;
|
||||||
line_width += space_width;
|
line_width += space_width;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user