Page MenuHomePhabricator

Textblock : Fix cursor cluster movement when emoji at the line start
ClosedPublic

Authored by AbdullehGhujeh on Apr 20 2020, 2:46 AM.

Details

Summary

if we have emoji only or emoji at line start we can move cursor using mouse click to be inside the emoji.

this should fix T8664

Test Plan
#include <Elementary.h>


EAPI_MAIN int
elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
{
   Evas_Object *win;

   elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
   win = elm_win_util_standard_add("emoji-test", "emoji-test");
   elm_win_autodel_set(win, EINA_TRUE);

   /* and now just resize the window to a size you want. normally widgets
    * will determine the initial size though */
   evas_object_resize(win, 320, 320);

   Evas_Object *box;
   box = elm_box_add(win);
   evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL);
   elm_win_resize_object_add(win, box);
 
   Evas_Object *entry;
   entry = elm_entry_add(box);

   elm_entry_entry_set(entry, "&#x262a;&#xfe0f;");

   evas_object_size_hint_weight_set(entry, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   evas_object_size_hint_align_set(entry, EVAS_HINT_FILL, EVAS_HINT_FILL);

   elm_box_pack_end(box, entry);

   evas_object_show(entry);
   evas_object_show(box);

   /* and show the window */
   evas_object_show(win);

   elm_run(); /* and run the program now, starting to handle all
               * events, etc. */

   /* exit code */
   return 0;
}
ELM_MAIN()

Diff Detail

Repository
rEFL core/efl
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
AbdullehGhujeh created this revision.Apr 20 2020, 2:46 AM

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/

AbdullehGhujeh requested review of this revision.Apr 20 2020, 2:46 AM
ali.alzyod requested changes to this revision.Apr 24 2020, 3:08 AM
ali.alzyod added inline comments.
src/lib/evas/canvas/evas_object_textblock.c
13354

The result runs as expected, but this part seems strange.
left_index in unsigned, and doing (--) it, when it is Zero will overflow the value.

So an additional change to ensure, that left_index-- will not overflow will be great.

This revision now requires changes to proceed.Apr 24 2020, 3:08 AM

change data type to int

AbdullehGhujeh marked an inline comment as done.Apr 27 2020, 1:35 AM

add safety condition

ali.alzyod accepted this revision.May 18 2020, 12:39 AM
ali.alzyod added reviewers: woohyun, bowonryu, zmike, bu5hm4n.

This patch seems fine to me

This revision is now accepted and ready to land.May 18 2020, 12:40 AM
ali.alzyod requested changes to this revision.Jun 2 2020, 1:28 AM

test passes with/without the change

This revision now requires changes to proceed.Jun 2 2020, 1:28 AM
ali.alzyod accepted this revision.Jun 3 2020, 1:19 AM

My mistake sorry

This revision is now accepted and ready to land.Jun 3 2020, 1:19 AM

Can we close this patch please, (unless there are some comments)

This revision was automatically updated to reflect the committed changes.