summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWooHyun Jung <wh0705.jung@samsung.com>2020-01-14 09:22:52 +0000
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2020-01-14 17:19:58 +0100
commit04d4aeb8b78c086a0f3ea4febca126f28ad4cce0 (patch)
tree4dc5d6f8a830bc9795644fec6b07cdd639dfae47
parentd412f73a99747be346927cba567480e786c3e3a4 (diff)
edje_entry: fix some preediting bugs
1. Attributes can come with random sequence. So, attribute list should be sorted based on start_index. 2. None tag can be used for some languages' preediting. So, the tag also needs to be handled the same with other tags. Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de> Differential Revision: https://phab.enlightenment.org/D11059
-rw-r--r--src/lib/edje/edje_entry.c24
1 files changed, 21 insertions, 3 deletions
diff --git a/src/lib/edje/edje_entry.c b/src/lib/edje/edje_entry.c
index 3d4e47207d..eb63c4f61f 100644
--- a/src/lib/edje/edje_entry.c
+++ b/src/lib/edje/edje_entry.c
@@ -4865,6 +4865,20 @@ _edje_entry_imf_event_commit_cb(void *data, Ecore_IMF_Context *ctx EINA_UNUSED,
4865 _edje_entry_real_part_configure(ed, rp); 4865 _edje_entry_real_part_configure(ed, rp);
4866} 4866}
4867 4867
4868static int
4869_sort_cb(const void *a1, const void *a2)
4870{
4871 Ecore_IMF_Preedit_Attr *attr1 = (Ecore_IMF_Preedit_Attr *)a1;
4872 Ecore_IMF_Preedit_Attr *attr2 = (Ecore_IMF_Preedit_Attr *)a2;
4873
4874 EINA_SAFETY_ON_NULL_RETURN_VAL(attr1, 0);
4875 EINA_SAFETY_ON_NULL_RETURN_VAL(attr2, 0);
4876
4877 if (attr1->start_index < attr2->start_index) return -1;
4878 else if (attr1->start_index == attr2->start_index) return 0;
4879 else return 1;
4880}
4881
4868static void 4882static void
4869_edje_entry_imf_event_preedit_changed_cb(void *data, Ecore_IMF_Context *ctx EINA_UNUSED, void *event_info EINA_UNUSED) 4883_edje_entry_imf_event_preedit_changed_cb(void *data, Ecore_IMF_Context *ctx EINA_UNUSED, void *event_info EINA_UNUSED)
4870{ 4884{
@@ -4927,10 +4941,11 @@ _edje_entry_imf_event_preedit_changed_cb(void *data, Ecore_IMF_Context *ctx EINA
4927 buf = eina_strbuf_new(); 4941 buf = eina_strbuf_new();
4928 if (attrs) 4942 if (attrs)
4929 { 4943 {
4944 attrs = eina_list_sort(attrs, 0, EINA_COMPARE_CB(_sort_cb));
4945
4930 EINA_LIST_FOREACH(attrs, l, attr) 4946 EINA_LIST_FOREACH(attrs, l, attr)
4931 { 4947 {
4932 if (attr->preedit_type < preedit_type_size && 4948 if (attr->preedit_type < preedit_type_size)
4933 tagname[attr->preedit_type])
4934 { 4949 {
4935 preedit_attr_str = eina_strbuf_new(); 4950 preedit_attr_str = eina_strbuf_new();
4936 if (preedit_attr_str) 4951 if (preedit_attr_str)
@@ -4940,7 +4955,10 @@ _edje_entry_imf_event_preedit_changed_cb(void *data, Ecore_IMF_Context *ctx EINA
4940 4955
4941 if (markup_txt) 4956 if (markup_txt)
4942 { 4957 {
4943 eina_strbuf_append_printf(buf, "<%s>%s</%s>", tagname[attr->preedit_type], markup_txt, tagname[attr->preedit_type]); 4958 if (tagname[attr->preedit_type])
4959 eina_strbuf_append_printf(buf, "<%s>%s</%s>", tagname[attr->preedit_type], markup_txt, tagname[attr->preedit_type]);
4960 else
4961 eina_strbuf_append_printf(buf, "%s", markup_txt);
4944 free(markup_txt); 4962 free(markup_txt);
4945 } 4963 }
4946 eina_strbuf_free(preedit_attr_str); 4964 eina_strbuf_free(preedit_attr_str);