From b541fd42de46e59f5c45c86b512fbaf141c068e8 Mon Sep 17 00:00:00 2001 From: CJ van den Berg Date: Fri, 19 Apr 2024 22:11:04 +0200 Subject: [PATCH] fix: don't prevent same file navigation if buffer is dirty --- src/tui/mainview.zig | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/tui/mainview.zig b/src/tui/mainview.zig index 8e6d0f6..7ac80d8 100644 --- a/src/tui/mainview.zig +++ b/src/tui/mainview.zig @@ -170,8 +170,6 @@ const cmds = struct { } pub fn navigate(self: *Self, ctx: Ctx) tp.result { - if (self.editor) |editor| if (editor.is_dirty()) - return tp.exit("unsaved changes"); const frame = tracy.initZone(@src(), .{ .name = "navigate" }); defer frame.deinit(); var file: ?[]const u8 = null; @@ -214,7 +212,10 @@ const cmds = struct { false else false; if (!same_file) { - if (self.editor) |editor| editor.send_editor_jump_source() catch {}; + if (self.editor) |editor| { + if (editor.is_dirty()) return tp.exit("unsaved changes"); + editor.send_editor_jump_source() catch {}; + } try self.create_editor(); try command.executeName("open_file", command.fmt(.{f})); }