summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBowon Ryu <bowon.ryu@samsung.com>2019-12-04 17:09:33 +0900
committerWooHyun Jung <wh0705.jung@samsung.com>2019-12-04 17:09:33 +0900
commit8cb0b193ea043bbd0d2a2162fa25f82aafaa50cd (patch)
treec7bef507e9e49cb21af548f915efe5abfdf03411
parent8f500460ad6a7235e3a5a2ad55a34cae400a96c6 (diff)
downloadefl-8cb0b193ea043bbd0d2a2162fa25f82aafaa50cd.tar.gz
edje_entry: converting plain_text to '*' using unicode units.
Summary: When converting plain_text to '*' in retrieve_surrounding_cb, always convert it to '*' in 1 byte unit. For example, 2 byte character is converted to "* *" and 3 byte character is converted to "* * *" However, this does not match the number of '*' printed in the entry. Because, '*' in the entry is printed according to number of unicode characters. This patch converts plain_text into unicode units when converting plain_text to '*' Test Plan: N/A Reviewers: woohyun Reviewed By: woohyun Subscribers: cedric, #reviewers, jihoon, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D10792
-rw-r--r--src/lib/edje/edje_entry.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/lib/edje/edje_entry.c b/src/lib/edje/edje_entry.c
index 29e0f10c96..e87576b4ac 100644
--- a/src/lib/edje/edje_entry.c
+++ b/src/lib/edje/edje_entry.c
@@ -4736,9 +4736,23 @@ _edje_entry_imf_retrieve_surrounding_cb(void *data, Ecore_IMF_Context *ctx EINA_
{
if (ecore_imf_context_input_hint_get(ctx) & ECORE_IMF_INPUT_HINT_SENSITIVE_DATA)
{
+ int idx = 0;
char *itr = NULL;
- for (itr = plain_text; itr && *itr; ++itr)
- *itr = '*';
+ size_t len = eina_unicode_utf8_get_len(plain_text);
+ char *u_text = (char *)malloc(len * sizeof(char) + 1);
+ if (!u_text) return EINA_FALSE;
+
+ itr = u_text;
+ while (eina_unicode_utf8_next_get(plain_text, &idx))
+ {
+ *itr = '*';
+ itr++;
+ }
+ *itr = 0;
+
+ plain_text = strdup(u_text);
+ free(u_text);
+ u_text = NULL;
}
*text = strdup(plain_text);