enventor - update the status of the cursor position correctly.

status of the cursor position should be updated whenever cursor is changed regardless of it's mechanism.
This commit is contained in:
ChunEon Park 2013-10-18 14:58:40 +09:00
parent 303bd779e1
commit 6f06d145e7
1 changed files with 12 additions and 1 deletions

View File

@ -397,6 +397,7 @@ cur_line_pos_set(edit_data *ed)
Evas_Coord y, h;
elm_entry_cursor_geometry_get(ed->en_edit, NULL, &y, NULL, &h);
int line = (y / h) + 1;
if (line < 0) line = 0;
if (ed->cur_line == line) return;
ed->cur_line = line;
stats_line_num_update(ed->sd, ed->cur_line, ed->line_max);
@ -598,10 +599,17 @@ edit_cursor_changed_manual_cb(void *data, Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED)
{
edit_data *ed = data;
cur_line_pos_set(ed);
edit_view_sync(ed);
}
static void
edit_cursor_changed_cb(void *data, Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED)
{
edit_data *ed = data;
cur_line_pos_set(ed);
}
void
edit_view_sync_cb_set(edit_data *ed,
void (*cb)(void *data, Eina_Stringshare *part_name,
@ -690,6 +698,8 @@ edit_init(Evas_Object *parent, stats_data *sd, config_data *cd)
evas_object_smart_callback_add(en_edit, "changed,user", edit_changed_cb, ed);
evas_object_smart_callback_add(en_edit, "cursor,changed,manual",
edit_cursor_changed_manual_cb, ed);
evas_object_smart_callback_add(en_edit, "cursor,changed",
edit_cursor_changed_cb, ed);
evas_object_smart_callback_add(en_edit, "clicked,double",
edit_cursor_double_clicked_cb, ed);
evas_object_size_hint_weight_set(en_edit, EVAS_HINT_EXPAND,
@ -709,6 +719,7 @@ edit_init(Evas_Object *parent, stats_data *sd, config_data *cd)
ed->layout = layout;
ed->parent = parent;
ed->linenumber = EINA_TRUE;
ed->cur_line = -1;
edit_line_number_toggle(ed);