terminal: store title set by escape sequences

Add a title field to Terminal, mirroring the existing pwd field.
The title is set via setTitle/getTitle and tracks the most recent
value written by OSC 0/2 sequences. The stream handler now persists
the title in terminal state in addition to forwarding it to the
surface. The field is cleared on full reset.
This commit is contained in:
Mitchell Hashimoto
2026-03-22 20:33:16 -07:00
parent 6366ce9a22
commit 08a44d7e69
2 changed files with 25 additions and 0 deletions

View File

@@ -999,6 +999,12 @@ pub const StreamHandler = struct {
return;
}
// Set the title on the terminal state. We ignore any errors since
// we can continue to operate just fine without it.
self.terminal.setTitle(title) catch |err| {
log.warn("error setting title in terminal state: {e}", .{err});
};
@memcpy(buf[0..title.len], title);
buf[title.len] = 0;