feat: add setTerminalWorkingDirectory (OSC7)
This commit is contained in:
parent
fcdeb321fe
commit
e4655a4ab4
2 changed files with 9 additions and 0 deletions
|
@ -1223,3 +1223,11 @@ pub fn prettyPrint(self: *Vaxis, tty: AnyWriter) !void {
|
|||
}
|
||||
try tty.writeAll("\r\n");
|
||||
}
|
||||
|
||||
/// Set the terminal's current working directory
|
||||
pub fn setTerminalWorkingDirectory(_: *Vaxis, tty: AnyWriter, path: []const u8) !void {
|
||||
if (path.len == 0 or path[0] != '/')
|
||||
return error.InvalidAbsolutePath;
|
||||
const hostname = std.posix.getenv("HOSTNAME") orelse "localhost";
|
||||
try tty.print(ctlseqs.osc7, .{ hostname, path });
|
||||
}
|
||||
|
|
|
@ -113,6 +113,7 @@ pub const strikethrough_reset = "\x1b[29m";
|
|||
|
||||
// OSC sequences
|
||||
pub const osc2_set_title = "\x1b]2;{s}\x1b\\";
|
||||
pub const osc7 = "\x1b]7;file://{s}{s}\x1b\\";
|
||||
pub const osc8 = "\x1b]8;{s};{s}\x1b\\";
|
||||
pub const osc8_clear = "\x1b]8;;\x1b\\";
|
||||
pub const osc9_notify = "\x1b]9;{s}\x1b\\";
|
||||
|
|
Loading…
Add table
Reference in a new issue