edje_entry: fix some preediting bugs
authorWooHyun Jung <wh0705.jung@samsung.com>
Tue, 14 Jan 2020 09:22:52 +0000 (09:22 +0000)
committerJongmin Lee <jm105.lee@samsung.com>
Tue, 14 Jan 2020 21:27:34 +0000 (06:27 +0900)
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

src/lib/edje/edje_entry.c

index b8e6dc5..100d273 100644 (file)
@@ -5528,9 +5528,11 @@ _sort_cb(const void *a1, const void *a2)
    Ecore_IMF_Preedit_Attr *attr1 = (Ecore_IMF_Preedit_Attr *)a1;
    Ecore_IMF_Preedit_Attr *attr2 = (Ecore_IMF_Preedit_Attr *)a2;
 
-   if (!attr1 || !attr2) return 0;
+   EINA_SAFETY_ON_NULL_RETURN_VAL(attr1, 0);
+   EINA_SAFETY_ON_NULL_RETURN_VAL(attr2, 0);
 
-   if (attr1->start_index <= attr2->start_index) return -1;
+   if (attr1->start_index < attr2->start_index) return -1;
+   else if (attr1->start_index == attr2->start_index) return 0;
    else return 1;
 }