1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-22 15:06:45 +00:00

[TextServer] Fix fallback line breaking code adding two breaks for CR-LF.

This commit is contained in:
bruvzg
2024-03-05 09:15:11 +02:00
parent a07dd0d6a5
commit b58e45ed43
2 changed files with 8 additions and 2 deletions

View File

@@ -5360,11 +5360,14 @@ bool TextServerAdvanced::_shaped_text_update_breaks(const RID &p_shaped) {
// No data loaded - use fallback.
for (int j = r_start; j < r_end; j++) {
char32_t c = sd->text[j - sd->start];
char32_t c_next = (j < r_end) ? sd->text[j - sd->start + 1] : 0x0000;
if (is_whitespace(c)) {
sd->breaks[j + 1] = false;
}
if (is_linebreak(c)) {
sd->breaks[j + 1] = true;
if (c != 0x000D || c_next != 0x000A) { // Skip first hard break in CR-LF pair.
sd->breaks[j + 1] = true;
}
}
}
} else {