diff options
author | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2024-08-09 00:03:00 +0300 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2024-09-16 16:38:23 +0200 |
commit | a7d79f9e6cd78de91deb2d3fa1257ebf1ab116b2 (patch) | |
tree | 4fefac2893ce39ded29339175f9923051f162d5f /servers | |
parent | fac12603efab36c1dbbc80b936a9ca312b268b02 (diff) | |
download | redot-engine-a7d79f9e6cd78de91deb2d3fa1257ebf1ab116b2.tar.gz |
Fix `TextServer::shaped_text_*_character_pos` for the first character of wrapped string. Allow starting/ending RTL selection before line start.
(cherry picked from commit 932acce8f290fe2231e81d685077af084666202e)
Diffstat (limited to 'servers')
-rw-r--r-- | servers/text_server.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/servers/text_server.cpp b/servers/text_server.cpp index e7a1511064..7b1e37a6cc 100644 --- a/servers/text_server.cpp +++ b/servers/text_server.cpp @@ -1563,7 +1563,7 @@ int64_t TextServer::shaped_text_prev_grapheme_pos(const RID &p_shaped, int64_t p int64_t TextServer::shaped_text_prev_character_pos(const RID &p_shaped, int64_t p_pos) const { const PackedInt32Array &chars = shaped_text_get_character_breaks(p_shaped); - int64_t prev = 0; + int64_t prev = shaped_text_get_range(p_shaped).x; for (const int32_t &E : chars) { if (E >= p_pos) { return prev; @@ -1575,7 +1575,7 @@ int64_t TextServer::shaped_text_prev_character_pos(const RID &p_shaped, int64_t int64_t TextServer::shaped_text_next_character_pos(const RID &p_shaped, int64_t p_pos) const { const PackedInt32Array &chars = shaped_text_get_character_breaks(p_shaped); - int64_t prev = 0; + int64_t prev = shaped_text_get_range(p_shaped).x; for (const int32_t &E : chars) { if (E > p_pos) { return E; @@ -1587,7 +1587,7 @@ int64_t TextServer::shaped_text_next_character_pos(const RID &p_shaped, int64_t int64_t TextServer::shaped_text_closest_character_pos(const RID &p_shaped, int64_t p_pos) const { const PackedInt32Array &chars = shaped_text_get_character_breaks(p_shaped); - int64_t prev = 0; + int64_t prev = shaped_text_get_range(p_shaped).x; for (const int32_t &E : chars) { if (E == p_pos) { return E; |