From 699e5eaac4ebff38670dcfb8f1b8a318acc4515e Mon Sep 17 00:00:00 2001 From: Youngbok Shin Date: Tue, 27 Dec 2016 15:21:56 +0900 Subject: [PATCH] edje/entry: fix to get start position of selection from surrounding_cb The cursor position when a entry has selection should be same from _edje_entry_imf_retrieve_surrounding_cb and _edje_entry_imf_event_delete_surrounding_cb functions. @tizen_fix Change-Id: Id3ea75e3ab574e1e99220ed826f3bfb0a02bb5a4 --- src/lib/edje/edje_entry.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/src/lib/edje/edje_entry.c b/src/lib/edje/edje_entry.c index f20b91a..c18111c 100644 --- a/src/lib/edje/edje_entry.c +++ b/src/lib/edje/edje_entry.c @@ -4929,12 +4929,30 @@ _edje_entry_imf_retrieve_surrounding_cb(void *data, Ecore_IMF_Context *ctx, char if (cursor_pos) { + /* TIZEN_ONLY(20161227): fix to get start position of selection from surrounding_cb if (en->have_selection && en->sel_start) *cursor_pos = evas_textblock_cursor_pos_get(en->sel_start); else if (en->cursor) *cursor_pos = evas_textblock_cursor_pos_get(en->cursor); else *cursor_pos = 0; + */ + if (en->have_selection) + { + if (evas_textblock_cursor_compare(en->sel_start, en->sel_end) < 0) + *cursor_pos = evas_textblock_cursor_pos_get(en->sel_start); + else + *cursor_pos = evas_textblock_cursor_pos_get(en->sel_end); + } + else if (en->cursor) + { + *cursor_pos = evas_textblock_cursor_pos_get(en->cursor); + } + else + { + *cursor_pos = 0; + } + /* END */ } return EINA_TRUE; @@ -5205,7 +5223,25 @@ _edje_entry_imf_event_delete_surrounding_cb(void *data, Ecore_IMF_Context *ctx E (rp->part->entry_mode < EDJE_ENTRY_EDIT_MODE_SELECTABLE)) return; + /* TIZEN_ONLY(20161227): fix to get start position of selection from surrounding_cb cursor_pos = evas_textblock_cursor_pos_get(en->cursor); + */ + if (en->have_selection) + { + if (evas_textblock_cursor_compare(en->sel_start, en->sel_end) < 0) + cursor_pos = evas_textblock_cursor_pos_get(en->sel_start); + else + cursor_pos = evas_textblock_cursor_pos_get(en->sel_end); + } + else if (en->cursor) + { + cursor_pos = evas_textblock_cursor_pos_get(en->cursor); + } + else + { + cursor_pos = 0; + } + /* END */ del_start = evas_object_textblock_cursor_new(en->rp->object); evas_textblock_cursor_pos_set(del_start, cursor_pos + ev->offset); -- 2.7.4