Fix first build error navigation

This commit is contained in:
Krzosa Karol
2026-03-19 10:43:22 +01:00
parent 3c6153380d
commit edb461bde8
2 changed files with 9 additions and 3 deletions

View File

@@ -45,7 +45,7 @@ BSet ExecBuild(String windows_cmd, String unix_cmd, String working_dir = Project
Exec(args); Exec(args);
} }
main.window->active_goto_list = build.view->id; main.window->active_goto_list = build.view->id;
main.window->goto_list_pos = 0; main.window->goto_list_pos = -1;
build.window->visible = true; build.window->visible = true;
return build; return build;
} }

View File

@@ -274,10 +274,16 @@ void GotoNextInList(Window *window, Int line_offset = 1) {
Buffer *buffer_goto = GetBuffer(view_goto->active_buffer); Buffer *buffer_goto = GetBuffer(view_goto->active_buffer);
int64_t pos = window->goto_list_pos; 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; 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); Range line_range = GetLineRangeWithoutNL(buffer_goto, i);
String16 string_line = GetString(buffer_goto, line_range); String16 string_line = GetString(buffer_goto, line_range);