From 70ec2a11c56d81933c136c868c67b9f56340394f Mon Sep 17 00:00:00 2001 From: CJ van den Berg Date: Tue, 27 Aug 2024 19:16:08 +0200 Subject: [PATCH] fix: only fallback to get_next_file in get_next_diagnostic if it is available --- src/tui/editor.zig | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/tui/editor.zig b/src/tui/editor.zig index 835bb5b..4140d56 100644 --- a/src/tui/editor.zig +++ b/src/tui/editor.zig @@ -3320,7 +3320,11 @@ pub const Editor = struct { } pub fn goto_next_diagnostic(self: *Self, _: Context) Result { - if (self.diagnostics.items.len == 0) return command.executeName("goto_next_file", .{}); + if (self.diagnostics.items.len == 0) { + if (command.getId("goto_next_file")) |id| + return command.execute(id, .{}); + return; + } self.sort_diagnostics(); const primary = self.get_primary(); for (self.diagnostics.items) |*diag| { @@ -3331,7 +3335,11 @@ pub const Editor = struct { } pub fn goto_prev_diagnostic(self: *Self, _: Context) Result { - if (self.diagnostics.items.len == 0) return command.executeName("goto_prev_file", .{}); + if (self.diagnostics.items.len == 0) { + if (command.getId("goto_prev_file")) |id| + return command.execute(id, .{}); + return; + } self.sort_diagnostics(); const primary = self.get_primary(); var i = self.diagnostics.items.len - 1;