From bec736e618204ab5e72931da627d04a182959cc7 Mon Sep 17 00:00:00 2001 From: tasn Date: Tue, 10 Aug 2010 07:16:45 +0000 Subject: [PATCH] Edje: Fixed edje_object_part_text_cursor_content_get to handle non-english. Thanks to Brian Wang for reporting. git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/edje@50953 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/lib/edje_entry.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/lib/edje_entry.c b/src/lib/edje_entry.c index 252fefb..0fd2501 100644 --- a/src/lib/edje_entry.c +++ b/src/lib/edje_entry.c @@ -2437,16 +2437,21 @@ _edje_entry_cursor_content_get(Edje_Real_Part *rp, Edje_Cursor cur) Evas_Textblock_Cursor *c = _cursor_get(rp, cur); const char *s; static char buf[16]; - int pos, pos2, ch; + int pos, pos2, i; if (!c) return NULL; s = evas_textblock_node_format_text_get(evas_textblock_cursor_format_get(c)); if (s) return s; s = evas_textblock_cursor_paragraph_text_get(c); if (!s) return NULL; pos = evas_textblock_cursor_pos_get(c); - pos2 = evas_string_char_next_get(s, pos, &ch); - strncpy(buf, s + pos, pos2 - pos); - buf[pos2 - pos] = 0; + /* Get the actual utf8 pos */ + for (i = 0 ; pos > 0 ; pos--) + { + i = evas_string_char_next_get(s, i, NULL); + } + pos2 = evas_string_char_next_get(s, i, NULL); + strncpy(buf, s + i, pos2 - i); + buf[pos2 - i] = 0; return buf; } -- 2.7.4