diff options
author | Tom Hacohen <tom@stosb.com> | 2019-10-02 18:27:44 +0300 |
---|---|---|
committer | Tom Hacohen <tom@stosb.com> | 2019-10-12 17:52:19 +0300 |
commit | d119b12c04c058313717115c361aa4e5fc7383ed (patch) | |
tree | ae25478396c69fd726e0ededef3224f367f80ed3 | |
parent | 4857fc83a2adfb37886dad57476345f657465586 (diff) | |
download | efl-d119b12c04c058313717115c361aa4e5fc7383ed.tar.gz |
Canvas text: fix jump by.
-rw-r--r-- | src/lib/evas/canvas/efl_canvas_text.c | 31 |
1 files changed, 4 insertions, 27 deletions
diff --git a/src/lib/evas/canvas/efl_canvas_text.c b/src/lib/evas/canvas/efl_canvas_text.c index 862c318c5f..a010fba9c1 100644 --- a/src/lib/evas/canvas/efl_canvas_text.c +++ b/src/lib/evas/canvas/efl_canvas_text.c @@ -8816,7 +8816,7 @@ _canvas_text_cursor_line_jump_by(Efl2_Text_Cursor_Handle *cur, int by) // Eo *eo_obj = cur->obj; int ln; Evas_Coord cx, cw; - Evas_Coord lx, ly, lw, lh; + Evas_Coord ly, lh; int last; Evas_Object_Textblock_Node_Text *pnode; size_t ppos; @@ -8848,32 +8848,9 @@ _canvas_text_cursor_line_jump_by(Efl2_Text_Cursor_Handle *cur, int by) else { - // FIXME: This code seems to have a bug. It should just set the line and then set the x and that's it. - if (evas_object_textblock_line_number_geometry_get(cur->obj, - ln, &lx, &ly, &lw, &lh) && - (!_canvas_text_cursor_coord_set(cur, cx, ly + (lh / 2)))) - { - _canvas_text_cursor_line_number_set(cur, ln); - if (cx < (lx + (lw / 2))) - { - if (ln == last) - { - _canvas_text_cursor_paragraph_last(cur); - _canvas_text_cursor_paragraph_end(cur); - } - _canvas_text_cursor_line_start(cur); - } - else - { - if (ln == last) - { - _canvas_text_cursor_paragraph_last(cur); - _canvas_text_cursor_paragraph_end(cur); - } - else - _canvas_text_cursor_line_end(cur); - } - } + _canvas_text_cursor_line_number_set(cur, ln); + _cavas_text_cursor_geometry_get_old(cur, NULL, &ly, NULL, &lh, NULL, EVAS_TEXTBLOCK_CURSOR_UNDER); + _canvas_text_cursor_coord_set(cur, cx, ly + (lh / 2)); } if ((pnode != cur->node) || (ppos != cur->pos)) |