From f9d5289ce6a668265647133afeb2baf900465606 Mon Sep 17 00:00:00 2001 From: Andy Williams Date: Fri, 11 May 2018 13:13:35 +0100 Subject: [PATCH] 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. --- src/bin/editor/edi_editor.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/bin/editor/edi_editor.c b/src/bin/editor/edi_editor.c index 526d52b..744e1dd 100644 --- a/src/bin/editor/edi_editor.c +++ b/src/bin/editor/edi_editor.c @@ -856,15 +856,21 @@ _smart_cb_key_down(void *data EINA_UNUSED, Evas *e EINA_UNUSED, static void _edit_cursor_moved(void *data, Evas_Object *obj, void *event_info EINA_UNUSED) { + Elm_Code *code; + Elm_Code_Line *line; Elm_Code_Widget *widget; char buf[30]; - unsigned int line; + unsigned int row; unsigned int col; widget = (Elm_Code_Widget *)obj; - elm_code_widget_cursor_position_get(widget, &line, &col); + elm_code_widget_cursor_position_get(widget, &row, &col); - snprintf(buf, sizeof(buf), _("Line:%d, Column:%d"), line, col); + code = elm_code_widget_code_get(widget); + line = elm_code_file_line_get(code->file, row); + + snprintf(buf, sizeof(buf), _("Line:%d, Position:%d"), row, + elm_code_widget_line_text_position_for_column_get(widget, line, col) + 1); elm_object_text_set((Evas_Object *)data, buf); }