tasn pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=a867caf2604b943630d534f7345a571d8a8d9fdb

commit a867caf2604b943630d534f7345a571d8a8d9fdb
Author: shilpa.singh <shilpa.si...@samsung.com>
Date:   Wed Jun 3 16:39:42 2015 +0100

    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
---
 src/lib/edje/edje_entry.c | 26 ++++++++++++++++----------
 1 file changed, 16 insertions(+), 10 deletions(-)

diff --git a/src/lib/edje/edje_entry.c b/src/lib/edje/edje_entry.c
index c088610..7d816fd 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,
                }
              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 */

-- 


Reply via email to