feat: make change_project call open_recent instead of jumping to last file

This commit is contained in:
CJ van den Berg 2025-08-04 20:53:35 +02:00
parent 4ee3dd4bba
commit a9380e0395
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9

View file

@ -337,8 +337,7 @@ const cmds = struct {
tui.rdr().set_terminal_working_directory(project);
if (self.top_bar) |bar| _ = try bar.msg(.{ "PRJ", "open" });
if (self.bottom_bar) |bar| _ = try bar.msg(.{ "PRJ", "open" });
if (try project_manager.request_most_recent_file(self.allocator)) |file_path|
self.show_file_async_and_free(file_path);
tp.self_pid().send(.{ "cmd", "open_recent" }) catch return;
}
pub const change_project_meta: Meta = .{ .arguments = &.{.string} };
@ -1224,11 +1223,6 @@ fn toggle_inputview_async(_: *Self) void {
tp.self_pid().send(.{ "cmd", "toggle_inputview" }) catch return;
}
fn show_file_async_and_free(self: *Self, file_path: []const u8) void {
defer self.allocator.free(file_path);
self.show_file_async(file_path);
}
fn show_file_async(_: *Self, file_path: []const u8) void {
tp.self_pid().send(.{ "cmd", "navigate", .{ .file = file_path } }) catch return;
}