feat: update terminal working directory on project change

This commit is contained in:
CJ van den Berg 2024-08-19 21:53:30 +02:00
parent 849ef606a7
commit 53310cc2dd
3 changed files with 10 additions and 2 deletions

View file

@ -330,6 +330,10 @@ pub fn set_terminal_style(self: *Self, style_: Style) void {
self.vx.state.changed_default_bg = false;
}
pub fn set_terminal_working_directory(self: *Self, absolute_path: []const u8) void {
self.vx.setTerminalWorkingDirectory(self.tty.anyWriter(), absolute_path) catch {};
}
pub fn copy_to_system_clipboard(self: *Self, text: []const u8) void {
var bufferedWriter = self.tty.bufferedWriter();
self.vx.copyToSystemClipboard(bufferedWriter.writer().any(), text, self.a) catch |e| log.logger(log_name).err("copy_to_system_clipboard", e);

View file

@ -233,6 +233,8 @@ const cmds = struct {
if (!try ctx.args.match(.{tp.extract(&project_dir)}))
return;
try project_manager.open(project_dir);
const project = tp.env.get().str("project");
tui.current().rdr.set_terminal_working_directory(project);
_ = try self.statusbar.msg(.{ "PRJ", "open" });
}
@ -253,6 +255,8 @@ const cmds = struct {
if (self.file_list_type == .diagnostics and self.is_panel_view_showing(filelist_view))
try self.toggle_panel_view(filelist_view, false);
try project_manager.open(project_dir);
const project = tp.env.get().str("project");
tui.current().rdr.set_terminal_working_directory(project);
_ = try self.statusbar.msg(.{ "PRJ", "open" });
}