edje entry: return correct selection
authorThiep Ha <thiepha@gmail.com>
Thu, 26 Nov 2015 07:52:48 +0000 (09:52 +0200)
committerDaniel Hirt <daniel.hirt@samsung.com>
Thu, 26 Nov 2015 08:11:54 +0000 (10:11 +0200)
commit76939252278e4622067f9481251d03439a98761f
treeda8d0ab938efabeb6041279d928b2d78cf0edc1d
parent08e60f0873b2ccb22050da25191ce539e2135058
edje entry: return correct selection

Summary:
In entry, when selection_get function is called, selection is not
always returned the current selection.

Scenario:
- 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.

Reason:
- 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.

@fix

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