herdsman pushed a commit to branch master.


commit 76939252278e4622067f9481251d03439a98761f
Author: Thiep Ha <thie...@gmail.com>
Date:   Thu Nov 26 09:52:48 2015 +0200

    edje entry: return correct selection
    In entry, when selection_get function is called, selection is not
    always returned the current selection.
    - In select mode, entry has selection (e.g, by double click).
    - When selection handler is moved, set the cursor the current coordinate
      with edje_object_part_text_cursor_pos_set() API.
    - Edje emits "selection,changed" signal.
    - Elementary gets current selection and stores it.
    - Elementary does not get selection as visual selection (e.g, text is
       highlighted with "entry test", but the selection returned
       from edje is "entry").
    - If we copy and then paste to the entry, the pasted text is not same as
       selected text.
    - In _edje_entry_cursor_coord_set function, if entry has selection, we only
      emit "selection,changed" signal without freeing en->selection.
    - When _edje_entry_selection_get is called, we check the en->selection,
      since it is existed, we just return it which is not updated one.
    This patch clears en->selection, so that it is updated at _selection_get,
    and the updated selection is returned to caller.
    Test Plan:
    In mobile profile, open entry
    - Right click, choose select, double click -> selection handlers are shown.
    - Drag selection handlers to change selection.
    - Right click, do copy.
    - Right click, do paste.
    - See the pasted text is not same as selection.
    Reviewers: raster, tasn, herdsman
    Subscribers: seoz, JackDanielZ, cedric
    Differential Revision: https://phab.enlightenment.org/D2746
 src/lib/edje/edje_entry.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/lib/edje/edje_entry.c b/src/lib/edje/edje_entry.c
index 92c40a6..c9b424c 100644
--- a/src/lib/edje/edje_entry.c
+++ b/src/lib/edje/edje_entry.c
@@ -3856,7 +3856,14 @@ _edje_entry_cursor_coord_set(Edje_Real_Part *rp, 
Edje_Cursor cur,
         if (en->have_selection)
-          _edje_emit(en->ed, "selection,changed", rp->part->name);
+          {
+             if (en->selection)
+               {
+                  free(en->selection);
+                  en->selection = NULL;
+               }
+             _edje_emit(en->ed, "selection,changed", rp->part->name);
+          }
    return evas_textblock_cursor_char_coord_set(c, x, y);


Reply via email to