summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlastair Poole <netstar@gmail.com>2020-04-29 10:29:50 +0100
committerAlastair Poole <netstar@gmail.com>2020-04-29 10:29:50 +0100
commit876101cf957dc54c80d6812707dcef032cf91fb9 (patch)
tree2a8de512191b5186de5e60d7e99cdba71e920cdc
parentecfbe9c608b0ab3ecb0fa86abfd15b8dbd3249e9 (diff)
panel: Fix mainview_goto_end()
Andy already added some of these APIs :)
-rw-r--r--src/bin/mainview/edi_mainview_panel.c18
1 files changed, 2 insertions, 16 deletions
diff --git a/src/bin/mainview/edi_mainview_panel.c b/src/bin/mainview/edi_mainview_panel.c
index 05eac1b..83da9ed 100644
--- a/src/bin/mainview/edi_mainview_panel.c
+++ b/src/bin/mainview/edi_mainview_panel.c
@@ -976,8 +976,7 @@ edi_mainview_panel_goto_end(Edi_Mainview_Panel *panel)
Edi_Editor *editor;
Elm_Code *code;
Elm_Code_Line *line;
- const char *ch;
- unsigned int row, tabstop, length = 0;
+ unsigned int row, length;
if (!panel || !panel->current)
return;
@@ -989,26 +988,13 @@ edi_mainview_panel_goto_end(Edi_Mainview_Panel *panel)
code = elm_code_widget_code_get(editor->entry);
if (!code) return;
- tabstop = elm_code_widget_tabstop_get(editor->entry);
-
row = elm_code_file_lines_get(code->file);
if (row <= 0) return;
line = elm_code_file_line_get(code->file, row);
if (!line) return;
- if (line->content)
- {
- for (ch = line->content; *ch; ch++)
- {
- if (*ch == '\t')
- length += tabstop;
- else
- length++;
- }
- }
- else
- length = line->length;
+ length = elm_code_widget_line_text_column_width_get(editor->entry, line) + 1;
elm_code_widget_cursor_position_set(editor->entry, elm_code_file_lines_get(code->file), length);
}