cedric pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=343d2e0d8778f8e7df207ae94eb88d873b3c3487

commit 343d2e0d8778f8e7df207ae94eb88d873b3c3487
Author: Cedric Bail <[email protected]>
Date:   Sat Mar 11 16:52:04 2017 -0800

    elementary: force elm_code line fill on object resize.
    
    This fix elementary_test use of elm_code where the object needed
    to get clicked to have their content displayed. The reason was that
    the line where appended while the object size was 0 and once it was
    resized the line where not displayed.
---
 src/lib/elementary/elm_code_widget.c | 29 ++++++++++++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)

diff --git a/src/lib/elementary/elm_code_widget.c 
b/src/lib/elementary/elm_code_widget.c
index 994518a..c4db184 100644
--- a/src/lib/elementary/elm_code_widget.c
+++ b/src/lib/elementary/elm_code_widget.c
@@ -1944,7 +1944,34 @@ _elm_code_widget_resize(Elm_Code_Widget *widget, 
Elm_Code_Line *newline)
         evas_object_size_hint_min_set(grid, w*cw, ch);
      }
 
-   if (!newline) return;
+   if (!newline)
+     {
+        Evas_Coord scroll_y, scroll_h, oy;
+        unsigned int first_row, last_row;
+        unsigned int y;
+
+        evas_object_geometry_get(widget, NULL, &oy, NULL, NULL);
+        elm_scroller_region_get(pd->scroller, NULL, &scroll_y, NULL, 
&scroll_h);
+        if (scroll_h == 0)
+          return;
+
+        elm_code_widget_position_at_coordinates_get(widget, 0, oy, &first_row, 
NULL);
+        elm_code_widget_position_at_coordinates_get(widget, 0, oy + scroll_h, 
&last_row, NULL);
+        if (last_row > elm_code_file_lines_get(pd->code->file))
+          last_row = elm_code_file_lines_get(pd->code->file);
+
+        // cursor will be shown if it should be visible
+        evas_object_hide(pd->cursor_rect);
+        for (y = first_row; y <= last_row; y++)
+          {
+             line = elm_code_file_line_get(pd->code->file, y);
+             if (line)
+               _elm_code_widget_fill_line(widget, line);
+          }
+
+        return;
+     }
+   _elm_code_widget_fill_line(widget, line);
 
    if (pd->gravity_x == 1.0 || pd->gravity_y == 1.0)
      _elm_code_widget_scroll_by(widget,

-- 


Reply via email to