summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshilpa.singh <shilpa.singh@samsung.com>2015-06-03 16:39:42 +0100
committerTom Hacohen <tom@stosb.com>2015-06-03 16:39:42 +0100
commita867caf2604b943630d534f7345a571d8a8d9fdb (patch)
tree8bc04a75adc69fda9395f3671e0a6770b22e981e
parenta88aebe8ccf23778a0e82504aadd9c87b09d20bd (diff)
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
-rw-r--r--src/lib/edje/edje_entry.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/src/lib/edje/edje_entry.c b/src/lib/edje/edje_entry.c
index c088610dd1..7d816fdb9c 100644
--- a/src/lib/edje/edje_entry.c
+++ b/src/lib/edje/edje_entry.c
@@ -1502,11 +1502,14 @@ _edje_key_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
1502 } 1502 }
1503 else 1503 else
1504 { 1504 {
1505 if (evas_textblock_cursor_compare(en->sel_start, en->sel_end) < 0) 1505 if (en->have_selection)
1506 evas_textblock_cursor_copy(en->sel_start, en->cursor); 1506 {
1507 else 1507 if (evas_textblock_cursor_compare(en->sel_start, en->sel_end) < 0)
1508 evas_textblock_cursor_copy(en->sel_end, en->cursor); 1508 evas_textblock_cursor_copy(en->sel_start, en->cursor);
1509 _sel_clear(ed, en->cursor, rp->object, en); 1509 else
1510 evas_textblock_cursor_copy(en->sel_end, en->cursor);
1511 _sel_clear(ed, en->cursor, rp->object, en);
1512 }
1510 } 1513 }
1511 } 1514 }
1512 if (evas_textblock_cursor_char_prev(en->cursor)) 1515 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,
1537 } 1540 }
1538 else 1541 else
1539 { 1542 {
1540 if (evas_textblock_cursor_compare(en->sel_start, en->sel_end) < 0) 1543 if (en->have_selection)
1541 evas_textblock_cursor_copy(en->sel_end, en->cursor); 1544 {
1542 else 1545 if (evas_textblock_cursor_compare(en->sel_start, en->sel_end) < 0)
1543 evas_textblock_cursor_copy(en->sel_start, en->cursor); 1546 evas_textblock_cursor_copy(en->sel_end, en->cursor);
1544 _sel_clear(ed, en->cursor, rp->object, en); 1547 else
1548 evas_textblock_cursor_copy(en->sel_start, en->cursor);
1549 _sel_clear(ed, en->cursor, rp->object, en);
1550 }
1545 } 1551 }
1546 } 1552 }
1547 /* If control is pressed, go to the end of the word */ 1553 /* If control is pressed, go to the end of the word */