fix: don't prevent same file navigation if buffer is dirty
This commit is contained in:
parent
0523350596
commit
b541fd42de
1 changed files with 4 additions and 3 deletions
|
@ -170,8 +170,6 @@ const cmds = struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn navigate(self: *Self, ctx: Ctx) tp.result {
|
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" });
|
const frame = tracy.initZone(@src(), .{ .name = "navigate" });
|
||||||
defer frame.deinit();
|
defer frame.deinit();
|
||||||
var file: ?[]const u8 = null;
|
var file: ?[]const u8 = null;
|
||||||
|
@ -214,7 +212,10 @@ const cmds = struct {
|
||||||
false else false;
|
false else false;
|
||||||
|
|
||||||
if (!same_file) {
|
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 self.create_editor();
|
||||||
try command.executeName("open_file", command.fmt(.{f}));
|
try command.executeName("open_file", command.fmt(.{f}));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue