forked from enlightenment/efl
editor: Fix performance of loading large files
This commit is contained in:
parent
5a1629e7a4
commit
151956ea93
|
@ -414,10 +414,17 @@ static Eina_Bool
|
|||
_elm_code_widget_line_cb(void *data, Eo *obj EINA_UNUSED,
|
||||
const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
|
||||
{
|
||||
Elm_Code_Line *line;
|
||||
Elm_Code_Widget *widget;
|
||||
Eina_Bool visible;
|
||||
|
||||
line = (Elm_Code_Line *)event_info;
|
||||
widget = (Elm_Code_Widget *)data;
|
||||
|
||||
eo_do(widget, visible = elm_code_widget_line_visible_get(line));
|
||||
if (!visible)
|
||||
return EO_CALLBACK_CONTINUE;
|
||||
|
||||
// FIXME refresh just the row unless we have resized (by being the result of a row append)
|
||||
_elm_code_widget_fill(widget);
|
||||
|
||||
|
@ -1121,6 +1128,20 @@ _elm_code_widget_line_refresh(Eo *obj, Elm_Code_Widget_Data *pd EINA_UNUSED, Elm
|
|||
_elm_code_widget_fill_line(obj, line);
|
||||
}
|
||||
|
||||
EOAPI Eina_Bool
|
||||
_elm_code_widget_line_visible_get(Eo *obj EINA_UNUSED, Elm_Code_Widget_Data *pd, Elm_Code_Line *line)
|
||||
{
|
||||
Evas_Coord cellh, viewy, viewh;
|
||||
|
||||
elm_scroller_region_get(pd->scroller, NULL, &viewy, NULL, &viewh);
|
||||
evas_object_textgrid_cell_size_get(pd->grid, NULL, &cellh);
|
||||
|
||||
if (((int)line->number - 1) * cellh > viewy + viewh || (int)line->number * cellh < viewy)
|
||||
return EINA_FALSE;
|
||||
|
||||
return EINA_TRUE;;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_elm_code_widget_font_size_set(Eo *obj EINA_UNUSED, Elm_Code_Widget_Data *pd, Evas_Font_Size font_size)
|
||||
{
|
||||
|
|
|
@ -187,6 +187,12 @@ class Elm_Code_Widget (Elm_Layout, Elm_Interface_Atspi_Text)
|
|||
Elm_Code_Line *line; /*@ @in The line to refresh. */
|
||||
}
|
||||
}
|
||||
line_visible_get {
|
||||
params {
|
||||
Elm_Code_Line *line; /*@ @in The line to test for visibility. */
|
||||
}
|
||||
return: bool (visible); /*@ true if the line specified is currently visible within the scroll region. */
|
||||
}
|
||||
}
|
||||
implements {
|
||||
class.constructor;
|
||||
|
|
Loading…
Reference in New Issue