diff options
author | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2020-12-17 23:38:55 +0200 |
---|---|---|
committer | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2020-12-21 07:49:26 +0200 |
commit | 7d5a8ea0e9c22b5e9b513de6ceb49f34fe120cc3 (patch) | |
tree | 96665195b596dcce39852757da1653217ef89845 | |
parent | bccbd4be90baa8ad104f05310e7bbc3dbde33060 (diff) |
Always include space characters (including tabs and other space-like chars) into selection rectangles.
-rw-r--r-- | servers/text_server.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/servers/text_server.cpp b/servers/text_server.cpp index 30dfa60ba3..68864980e2 100644 --- a/servers/text_server.cpp +++ b/servers/text_server.cpp @@ -905,7 +905,7 @@ Vector<Vector2> TextServer::shaped_text_get_selection(RID p_shaped, int p_start, float off = 0.0f; for (int i = 0; i < v_size; i++) { for (int k = 0; k < glyphs[i].repeat; k++) { - if (glyphs[i].count > 0 && glyphs[i].index != 0) { + if ((glyphs[i].count > 0) && ((glyphs[i].index != 0) || ((glyphs[i].flags & GRAPHEME_IS_SPACE) == GRAPHEME_IS_SPACE))) { if (glyphs[i].start < end && glyphs[i].end > start) { // Grapheme fully in selection range. if (glyphs[i].start >= start && glyphs[i].end <= end) { @@ -963,6 +963,10 @@ Vector<Vector2> TextServer::shaped_text_get_selection(RID p_shaped, int p_start, // Merge intersecting ranges. int i = 0; while (i < ranges.size()) { + i++; + } + i = 0; + while (i < ranges.size()) { int j = i + 1; while (j < ranges.size()) { if (Math::is_equal_approx(ranges[i].y, ranges[j].x, UNIT_EPSILON)) { |