ajwillia-ms pushed a commit to branch master.

http://git.enlightenment.org/tools/edi.git/commit/?id=932bf49291eccfde81e0acc59444bf41f95f6524

commit 932bf49291eccfde81e0acc59444bf41f95f6524
Author: Andy Williams <a...@andywilliams.me>
Date:   Thu Apr 28 22:32:43 2016 +0100

    [editor] Stop jumping around on click
    
    If there were many errors in the file the visibility
    calculations got screwy
---
 elm_code/src/lib/widget/elm_code_widget.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/elm_code/src/lib/widget/elm_code_widget.c 
b/elm_code/src/lib/widget/elm_code_widget.c
index 6433f2d..175849e 100644
--- a/elm_code/src/lib/widget/elm_code_widget.c
+++ b/elm_code/src/lib/widget/elm_code_widget.c
@@ -558,18 +558,23 @@ static void
 _elm_code_widget_cursor_ensure_visible(Elm_Code_Widget *widget)
 {
    Evas_Coord viewx, viewy, vieww, viewh, cellw, cellh;
-   Evas_Coord curx, cury;
+   Evas_Coord curx, cury, oy, rowy;
+   Evas_Object *grid;
    Elm_Code_Widget_Data *pd;
    int gutter;
 
    pd = eo_data_scope_get(widget, ELM_CODE_WIDGET_CLASS);
 
+   evas_object_geometry_get(widget, NULL, &oy, NULL, NULL);
    elm_scroller_region_get(pd->scroller, &viewx, &viewy, &vieww, &viewh);
    _elm_code_widget_cell_size_get(widget, &cellw, &cellh);
 
+   grid = eina_list_data_get(eina_list_nth_list(pd->grids, pd->cursor_line - 
1));
+   evas_object_geometry_get(grid, NULL, &rowy, NULL, NULL);
+
    gutter = elm_obj_code_widget_text_left_gutter_width_get(widget);
    curx = (pd->cursor_col + gutter - 1) * cellw;
-   cury = (pd->cursor_line - 1) * cellh;
+   cury = rowy + viewy - oy;
 
    if (curx >= viewx && cury >= viewy && curx + cellw <= viewx + vieww && cury 
+ cellh <= viewy + viewh)
      return;

-- 


Reply via email to