edi/elm_code/src/lib/widget/elm_code_widget_text.c

36 lines
684 B
C
Raw Normal View History

2015-01-28 16:36:28 -08:00
#ifdef HAVE_CONFIG
# include "config.h"
#endif
#include "Elm_Code.h"
#include "elm_code_widget_private.h"
2015-01-28 16:36:28 -08:00
static int
_elm_code_widget_text_line_number_width_get(Eo *obj EINA_UNUSED, Elm_Code_Widget_Data *pd)
2015-01-28 16:36:28 -08:00
{
int max;
max = elm_code_file_lines_get(pd->code->file);
if (max < 1)
max = 1;
return floor(log10(max)) + 1;
2015-01-28 16:36:28 -08:00
}
static int
_elm_code_widget_text_left_gutter_width_get(Eo *obj, Elm_Code_Widget_Data *pd)
2015-01-28 16:36:28 -08:00
{
Elm_Code_Widget *widget;
2015-01-28 16:36:28 -08:00
int width = 1; // the status icon, for now
widget = obj;
if (!widget)
return width;
2015-01-28 16:36:28 -08:00
if (pd->show_line_numbers)
width += _elm_code_widget_text_line_number_width_get(widget, pd);
2015-01-28 16:36:28 -08:00
return width;
}