forked from enlightenment/efl
Edje: Add have_selection check to avoid unnecessary function calls
Summary: Check for have_selection flag when left/arrow keys are pressed to jump across the selected text, to avoid unnecessary function calls of comparision, copy of sel_start and sel_end pointers. Test Plan: Press left and right arrow keys on selected and normal text. Reviewers: herdsman, tasn Subscribers: SubodhKumar, navnbeet, cedric Differential Revision: https://phab.enlightenment.org/D2621
This commit is contained in:
parent
a88aebe8cc
commit
a867caf260
|
@ -1502,11 +1502,14 @@ _edje_key_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
|
|||
}
|
||||
else
|
||||
{
|
||||
if (evas_textblock_cursor_compare(en->sel_start, en->sel_end) < 0)
|
||||
evas_textblock_cursor_copy(en->sel_start, en->cursor);
|
||||
else
|
||||
evas_textblock_cursor_copy(en->sel_end, en->cursor);
|
||||
_sel_clear(ed, en->cursor, rp->object, en);
|
||||
if (en->have_selection)
|
||||
{
|
||||
if (evas_textblock_cursor_compare(en->sel_start, en->sel_end) < 0)
|
||||
evas_textblock_cursor_copy(en->sel_start, en->cursor);
|
||||
else
|
||||
evas_textblock_cursor_copy(en->sel_end, en->cursor);
|
||||
_sel_clear(ed, en->cursor, rp->object, en);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (evas_textblock_cursor_char_prev(en->cursor))
|
||||
|
@ -1537,11 +1540,14 @@ _edje_key_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
|
|||
}
|
||||
else
|
||||
{
|
||||
if (evas_textblock_cursor_compare(en->sel_start, en->sel_end) < 0)
|
||||
evas_textblock_cursor_copy(en->sel_end, en->cursor);
|
||||
else
|
||||
evas_textblock_cursor_copy(en->sel_start, en->cursor);
|
||||
_sel_clear(ed, en->cursor, rp->object, en);
|
||||
if (en->have_selection)
|
||||
{
|
||||
if (evas_textblock_cursor_compare(en->sel_start, en->sel_end) < 0)
|
||||
evas_textblock_cursor_copy(en->sel_end, en->cursor);
|
||||
else
|
||||
evas_textblock_cursor_copy(en->sel_start, en->cursor);
|
||||
_sel_clear(ed, en->cursor, rp->object, en);
|
||||
}
|
||||
}
|
||||
}
|
||||
/* If control is pressed, go to the end of the word */
|
||||
|
|
Loading…
Reference in New Issue