mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-04-15 03:52:39 +00:00
@@ -186,6 +186,15 @@ const SemanticPromptKVIterator = struct {
|
||||
break :kv kv;
|
||||
};
|
||||
|
||||
// If we have an empty item, we return an empty key and value.
|
||||
//
|
||||
// This allows for trailing semicolons, but also lets us parse
|
||||
// (or rather, ignore) empty fields; for example `a=b;;e=f`.
|
||||
if (kv.len < 1) return .{
|
||||
.key = kv,
|
||||
.value = kv,
|
||||
};
|
||||
|
||||
const key = key: {
|
||||
const index = std.mem.indexOfScalar(u8, kv, '=') orelse break :key kv;
|
||||
kv[index] = 0;
|
||||
@@ -348,6 +357,18 @@ test "OSC 133: prompt_start with special_key empty" {
|
||||
try testing.expect(cmd.prompt_start.special_key == false);
|
||||
}
|
||||
|
||||
test "OSC 133: prompt_start with trailing ;" {
|
||||
const testing = std.testing;
|
||||
|
||||
var p: Parser = .init(null);
|
||||
|
||||
const input = "133;A;";
|
||||
for (input) |ch| p.next(ch);
|
||||
|
||||
const cmd = p.end(null).?.*;
|
||||
try testing.expect(cmd == .prompt_start);
|
||||
}
|
||||
|
||||
test "OSC 133: prompt_start with click_events true" {
|
||||
const testing = std.testing;
|
||||
|
||||
|
||||
@@ -398,11 +398,16 @@ pub const StreamHandler = struct {
|
||||
break :tmux;
|
||||
},
|
||||
|
||||
.exit => if (self.tmux_viewer) |viewer| {
|
||||
// Free our viewer state
|
||||
viewer.deinit();
|
||||
self.alloc.destroy(viewer);
|
||||
self.tmux_viewer = null;
|
||||
.exit => {
|
||||
// Free our viewer state if we have one
|
||||
if (self.tmux_viewer) |viewer| {
|
||||
viewer.deinit();
|
||||
self.alloc.destroy(viewer);
|
||||
self.tmux_viewer = null;
|
||||
}
|
||||
|
||||
// And always break since we assert below
|
||||
// that we're not handling an exit command.
|
||||
break :tmux;
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user