elm_entry: prevents invalid cursor position updates

Summary:
sd->cursor_pos is updated in _entry_cursor_changed_signal_cb.
Generally, there is no problem.
But in some cases, before the _entry_cursor_changed_signal_cb is called
there is a situation in which cursor_pos is updated through _elm_entry_efl_ui_widget_theme_apply.

In this case,
before _entry_cursor_changed_signal_cb is called,
in _elm_entry_efl_ui_widget_theme_apply ()
cursor_pos = sd->cursor_pos; The wrong cursor_pos is set here.
Because it is the value before sd->cursor_pos is updated.
This causes an invalid cursor position when entering a key into the entry.

This patch prevents sd->cursor_pos from being updated with invalid values.

Reviewers: zmike, woohyun

Reviewed By: zmike

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D8923
This commit is contained in:
Bowon Ryu 2019-05-21 09:30:04 -04:00 committed by Mike Blumenkrantz
parent 205e5a5fe8
commit b5a7ee2ae4
1 changed files with 8 additions and 1 deletions

View File

@ -925,7 +925,14 @@ _elm_entry_efl_ui_widget_theme_apply(Eo *obj, Elm_Entry_Data *sd)
edje_object_part_text_style_user_push(sd->entry_edje, "elm.text", stl_user);
eina_stringshare_del(stl_user);
cursor_pos = sd->cursor_pos;
cursor_pos = edje_object_part_text_cursor_pos_get
(sd->entry_edje, "elm.text", EDJE_CURSOR_MAIN);
if (cursor_pos != sd->cursor_pos)
{
sd->cursor_pos = cursor_pos;
sd->cur_changed = EINA_TRUE;
}
elm_object_text_set(obj, t);
eina_stringshare_del(t);