fix: navigate to editor_file_path only if it's buffer was restored

This commit is contained in:
CJ van den Berg 2025-11-26 16:01:31 +01:00
parent c8840f0756
commit 741096cb43
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9

View file

@ -1718,10 +1718,10 @@ fn extract_state(self: *Self, iter: *[]const u8) !void {
send_buffer_did_open(self.allocator, buffer) catch {};
if (editor_file_path) |file_path| {
try tp.self_pid().send(.{ "cmd", "navigate", .{ .file = file_path } });
} else {
try tp.self_pid().send(.{ "cmd", "close_file" });
if (self.buffer_manager.get_buffer_for_file(file_path)) |_|
return tp.self_pid().send(.{ "cmd", "navigate", .{ .file = file_path } });
}
try tp.self_pid().send(.{ "cmd", "close_file" });
}
fn send_buffer_did_open(allocator: std.mem.Allocator, buffer: *Buffer) !void {