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
Change-Id: I62e7bd9c8af9ae9048a3ff2d4f4c6912e1b33692
Signed-off-by: Wonki Kim <wonki_.kim@samsung.com>
(cur == EDJE_CURSOR_SELECTION_END))
{
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);
+ }
}
// TIZEN_ONLY(20150127): Add evas_textblock_cursor_cluster_* APIs.
//return evas_textblock_cursor_char_coord_set(c, x, y);