diff --git a/src/plugin_build_window.cpp b/src/plugin_build_window.cpp index 80c7e96..9012242 100644 --- a/src/plugin_build_window.cpp +++ b/src/plugin_build_window.cpp @@ -45,7 +45,7 @@ BSet ExecBuild(String windows_cmd, String unix_cmd, String working_dir = Project Exec(args); } main.window->active_goto_list = build.view->id; - main.window->goto_list_pos = 0; + main.window->goto_list_pos = -1; build.window->visible = true; return build; } diff --git a/src/window.cpp b/src/window.cpp index 45aced0..2ba3517 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -274,10 +274,16 @@ void GotoNextInList(Window *window, Int line_offset = 1) { Buffer *buffer_goto = GetBuffer(view_goto->active_buffer); int64_t pos = window->goto_list_pos; - Int line = PosToLine(buffer_goto, pos); + Int start_line = 0; + if (pos < 0) { + start_line = line_offset > 0 ? 0 : buffer_goto->line_starts.len - 1; + } else { + Int line = PosToLine(buffer_goto, pos); + start_line = line + line_offset; + } bool opened = false; - for (Int i = line + line_offset; i >= 0 && i < buffer_goto->line_starts.len; i += line_offset) { + for (Int i = start_line; i >= 0 && i < buffer_goto->line_starts.len; i += line_offset) { Range line_range = GetLineRangeWithoutNL(buffer_goto, i); String16 string_line = GetString(buffer_goto, line_range);