cedric pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=98a36f37f34fbe3621178372dd077f25f50d85b6

commit 98a36f37f34fbe3621178372dd077f25f50d85b6
Author: Minkyu Kang <mk7.k...@samsung.com>
Date:   Tue Mar 6 18:46:44 2018 -0800

    elementary: entry - recover cursor position when theme is changed
    
    Summary:
    When theme is applied text is reset and cursor position is set to 0.
    This patch is recover the position to previous after text is reset.
    
    Signed-off-by: Minkyu Kang <mk7.k...@samsung.com>
    
    Reviewers: cedric, jpeg, woohyun, herdsman
    
    Reviewed By: cedric
    
    Subscribers: cedric, jpeg
    
    Tags: #efl
    
    Differential Revision: https://phab.enlightenment.org/D5695
    
    Signed-off-by: Cedric Bail <ced...@osg.samsung.com>
---
 src/lib/elementary/elm_entry.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/lib/elementary/elm_entry.c b/src/lib/elementary/elm_entry.c
index 4cd96d47e6..a62795a708 100644
--- a/src/lib/elementary/elm_entry.c
+++ b/src/lib/elementary/elm_entry.c
@@ -861,6 +861,7 @@ _elm_entry_efl_ui_widget_theme_apply(Eo *obj, 
Elm_Entry_Data *sd)
    const char *stl_user;
    const char *style = elm_widget_style_get(obj);
    Efl_Ui_Theme_Apply theme_apply;
+   int cursor_pos;
 
    ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EFL_UI_THEME_APPLY_FAILED);
 
@@ -898,6 +899,8 @@ _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;
+
    elm_object_text_set(obj, t);
    eina_stringshare_del(t);
 
@@ -928,11 +931,10 @@ _elm_entry_efl_ui_widget_theme_apply(Eo *obj, 
Elm_Entry_Data *sd)
    edje_object_part_text_prediction_hint_set
      (sd->entry_edje, "elm.text", sd->prediction_hint);
 
-   // elm_entry_cursor_pos_set -> cursor,changed -> widget_show_region_set
-   // -> smart_objects_calculate will call all smart calculate functions,
-   // and one of them can delete elm_entry.
    evas_object_ref(obj);
 
+   if (cursor_pos) elm_entry_cursor_pos_set(obj, cursor_pos);
+
    if (efl_ui_focus_object_focus_get(obj))
      {
         edje_object_signal_emit(sd->entry_edje, "elm,action,focus", "elm");

-- 


Reply via email to