Display the text position rather than the visual column in info

This fixes a bug where compile warnings for lines with tabs
do not match.
This commit is contained in:
Andy Williams 2018-05-11 13:13:35 +01:00
parent 6277dbe47a
commit 36bc269047
2 changed files with 14 additions and 8 deletions

View File

@ -84,7 +84,7 @@ edi_content_image_add(Evas_Object *parent, Edi_Mainview_Item *item)
}
void
edi_content_statusbar_position_set(Evas_Object *position, unsigned int line, unsigned int col)
edi_content_statusbar_position_set(Evas_Object *position, unsigned int line, unsigned int pos)
{
char buf[64];
char text[128];
@ -92,9 +92,9 @@ edi_content_statusbar_position_set(Evas_Object *position, unsigned int line, uns
if (!position) return;
if (line && col)
if (line && pos)
{
snprintf(buf, sizeof(buf), _("Line: %d, Column: %d"), line, col);
snprintf(buf, sizeof(buf), _("Line: %d, Position: %d"), line, pos);
}
else
{

View File

@ -1260,23 +1260,29 @@ static void
_edit_cursor_moved(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
{
Edi_Mainview_Item *item;
Elm_Code *code;
Elm_Code_Line *line;
Elm_Code_Widget *widget;
unsigned int line;
unsigned int col;
unsigned int row, col, pos;
widget = (Elm_Code_Widget *)obj;
if (widget)
{
elm_code_widget_cursor_position_get(widget, &line, &col);
elm_code_widget_cursor_position_get(widget, &row, &col);
code = elm_code_widget_code_get(widget);
line = elm_code_file_line_get(code->file, row);
pos = elm_code_widget_line_text_position_for_column_get(widget, line, col) + 1;
}
else
{
line = 0; col = 0;
row = 0; pos = 0;
}
item = data;
edi_content_statusbar_position_set(item->pos, line, col);
edi_content_statusbar_position_set(item->pos, row, pos);
}
static void