- Attributes can come with random sequence. So, attribute list should be sorted based on start_index.
- None tag can be used for some languages' preediting. So, the tag also needs to be handled the same with other tags.
It seems that this patch has no reviewers specified. If you are unsure who can review your patch, please check this wiki page and see if anyone can be added: https://phab.enlightenment.org/w/maintainers_reviewers/
Sorry for giving little information about the patch.
This patch is for the case when preediting string comes with "none" tag and random start index.
- Input "S" (preediting string = "<preedit>S</preedit>")
- Input "a" (preediting string = "S<preedit>a</preedit>" and "Sa" should be in the elm_entry)
[With the problematic code]
At the step 2, in the loop of "EINA_LIST_FOREACH(attrs, l, attr)" , let's assume that "a" comes with "preedit tag" and "attr->start_index = 1" first.
Then, "eina_strbuf_append_printf(buf, "<%s>%s</%s>", tagname[attr->preedit_type], markup_txt, tagname[attr->preedit_type]);" will append "<preedit>a</preedit>" to the buf.
In the next loop, let's assume that "S" comes with "none tag" and "attr->start_index=0".
Then, "eina_strbuf_append(buf, preedit_string);" will append whole preediting string (="Sa") to existing buffer (="<preedit>a</preedit>").
So, the result is "<preedit>a</preedit>Sa".
[With the patch]
- "attrs" list is sorted based on the "attr->start_index". So, "S" will come first (i.e. earlier than "a").
- "none" tag will not append whole preediting string. So, only "S" will be appended to the buffer.
So, the expected result "S<preedit>a</preedit>" can some after the patch.
If my explanation would not be good enough for your understanding, please let me know.