diff options
author | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2022-03-05 22:31:58 +0200 |
---|---|---|
committer | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2022-03-05 22:31:58 +0200 |
commit | e88522f5b5ca1d87c1da06f4924a38bef1f9a1ef (patch) | |
tree | 6b9abfe413107fa35cc91c205212739870735ca5 /servers/text_server.cpp | |
parent | ff65d33e8c278bfbbbad18f9db959b2bbe04f919 (diff) | |
download | redot-engine-e88522f5b5ca1d87c1da06f4924a38bef1f9a1ef.tar.gz |
[TextServer] Improve word breaking when there are multiple spaces between words.
Diffstat (limited to 'servers/text_server.cpp')
-rw-r--r-- | servers/text_server.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/servers/text_server.cpp b/servers/text_server.cpp index 37cc6599b1..e84c0f05cc 100644 --- a/servers/text_server.cpp +++ b/servers/text_server.cpp @@ -752,15 +752,19 @@ PackedInt32Array TextServer::shaped_text_get_word_breaks(RID p_shaped, int p_gra for (int i = 0; i < l_size; i++) { if (l_gl[i].count > 0) { if ((l_gl[i].flags & p_grapheme_flags) != 0) { - words.push_back(word_start); - words.push_back(l_gl[i].start); + if (word_start != l_gl[i].start) { + words.push_back(word_start); + words.push_back(l_gl[i].start); + } word_start = l_gl[i].end; } } } if (l_size > 0) { - words.push_back(word_start); - words.push_back(range.y); + if (word_start != range.y) { + words.push_back(word_start); + words.push_back(range.y); + } } return words; |