diff --git a/src/bin/mainview/edi_mainview.c b/src/bin/mainview/edi_mainview.c index 603b037..7fc88c1 100644 --- a/src/bin/mainview/edi_mainview.c +++ b/src/bin/mainview/edi_mainview.c @@ -324,7 +324,12 @@ _edi_mainview_item_tab_add(Edi_Path_Options *options, const char *mime) elm_object_focus_set(editor->entry, EINA_TRUE); if (options->line) - edi_mainview_goto(options->line); + { + if (options->character > 1) + edi_mainview_goto_position(options->line, options->character); + else + edi_mainview_goto(options->line); + } _edi_project_config_tab_add(options->path, options->type, EINA_FALSE); } @@ -482,7 +487,12 @@ edi_mainview_open(Edi_Path_Options *options) { edi_mainview_item_select(it); if (options->line) - edi_mainview_goto(options->line); + { + if (options->character > 1) + edi_mainview_goto_position(options->line, options->character); + else + edi_mainview_goto(options->line); + } return; } @@ -735,23 +745,21 @@ edi_mainview_search() } void -edi_mainview_goto(int number) +edi_mainview_goto(unsigned int number) +{ + edi_mainview_goto_position(number, 1); +} + +void +edi_mainview_goto_position(unsigned int row, unsigned int col) { Edi_Editor *editor; - Elm_Code *code; - Elm_Code_Line *line; editor = (Edi_Editor *)evas_object_data_get(_current_view, "editor"); - if (!editor || number <= 0) + if (!editor || row <= 0 || col <= 0) return; - code = elm_code_widget_code_get(editor->entry); - - line = elm_code_file_line_get(code->file, number); - if (!line) - return; - - elm_code_widget_cursor_position_set(editor->entry, number, 1); + elm_code_widget_cursor_position_set(editor->entry, row, col); elm_object_focus_set(editor->entry, EINA_TRUE); } diff --git a/src/bin/mainview/edi_mainview.h b/src/bin/mainview/edi_mainview.h index e268b45..aced01f 100644 --- a/src/bin/mainview/edi_mainview.h +++ b/src/bin/mainview/edi_mainview.h @@ -210,7 +210,17 @@ void edi_mainview_search(); * * @ingroup Content */ -void edi_mainview_goto(int line); +void edi_mainview_goto(unsigned int line); + +/** + * Go to a requested line, column position in the current view's contents. + * + * @param row the line number (1 based) to scroll to + * @param col the column position (1 based) to scroll to + * + * @ingroup Content + */ +void edi_mainview_goto_position(unsigned int row, unsigned int col); /** * Present a popup that will initiate a goto in the current view.