efl_text_cursor: line jump by fix movement

Summary:
When the cursor is at line beginning of line, and user click "Up" then "Down" on keyboard cursor will position at second character.
If text is:  **occaecat \n mollit**

Reviewers: woohyun, zmike, cedric, segfaultxavi

Reviewed By: woohyun

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Maniphest Tasks: T8454

Differential Revision: https://phab.enlightenment.org/D10947
This commit is contained in:
Ali Alzyod 2019-12-26 09:55:28 +09:00 committed by WooHyun Jung
parent c008309f78
commit 84685df233
2 changed files with 8 additions and 1 deletions

View File

@ -11033,7 +11033,7 @@ evas_textblock_cursor_line_jump_by(Efl_Text_Cursor_Handle *cur, int by)
pnode = cur->node;
ppos = cur->pos;
evas_textblock_cursor_geometry_get(cur, &cx, NULL, &cw, NULL, NULL, EVAS_TEXTBLOCK_CURSOR_UNDER);
evas_textblock_cursor_geometry_get(cur, &cx, NULL, &cw, NULL, NULL, EVAS_TEXTBLOCK_CURSOR_BEFORE);
cx += (cw / 2);
evas_textblock_cursor_paragraph_last(cur);
last = evas_textblock_cursor_line_geometry_get(cur, NULL, NULL, NULL, NULL);

View File

@ -4522,6 +4522,13 @@ EFL_START_TEST(efl_canvas_textblock_cursor)
efl_text_cursor_text_object_get(cursor1),
efl_text_cursor_text_object_get(cursor_temp));
efl_text_set(txt, "occaecat \n mollit");
efl_text_cursor_move(cur_obj, EFL_TEXT_CURSOR_MOVE_TYPE_FIRST);
efl_text_cursor_line_jump_by(cur_obj, 1);
efl_text_cursor_line_jump_by(cur_obj, -1);
ck_assert_int_eq(efl_text_cursor_position_get(cur_obj), 0);
END_EFL_CANVAS_TEXTBLOCK_TEST();
}
EFL_END_TEST