Merge pull request #58806 from bruvzg/ts_multispace_word_brk
[TextServer] Improve word breaking when there are multiple spaces between words.
This commit is contained in:
commit
2d96b4c989
@ -752,16 +752,20 @@ PackedInt32Array TextServer::shaped_text_get_word_breaks(RID p_shaped, int p_gra
|
|||||||
for (int i = 0; i < l_size; i++) {
|
for (int i = 0; i < l_size; i++) {
|
||||||
if (l_gl[i].count > 0) {
|
if (l_gl[i].count > 0) {
|
||||||
if ((l_gl[i].flags & p_grapheme_flags) != 0) {
|
if ((l_gl[i].flags & p_grapheme_flags) != 0) {
|
||||||
|
if (word_start != l_gl[i].start) {
|
||||||
words.push_back(word_start);
|
words.push_back(word_start);
|
||||||
words.push_back(l_gl[i].start);
|
words.push_back(l_gl[i].start);
|
||||||
|
}
|
||||||
word_start = l_gl[i].end;
|
word_start = l_gl[i].end;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (l_size > 0) {
|
if (l_size > 0) {
|
||||||
|
if (word_start != range.y) {
|
||||||
words.push_back(word_start);
|
words.push_back(word_start);
|
||||||
words.push_back(range.y);
|
words.push_back(range.y);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return words;
|
return words;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user