mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 16:56:09 +03:00
Merge pull request #314 from hovsater/allow-opt-osc-52-parameter
Allow optional OSC 52 parameter
This commit is contained in:
@ -260,7 +260,12 @@ pub const Parser = struct {
|
|||||||
},
|
},
|
||||||
|
|
||||||
.clipboard_kind => switch (c) {
|
.clipboard_kind => switch (c) {
|
||||||
';' => self.state = .invalid,
|
';' => {
|
||||||
|
self.command.clipboard_contents.kind = 'c';
|
||||||
|
self.state = .string;
|
||||||
|
self.temp_state = .{ .str = &self.command.clipboard_contents.data };
|
||||||
|
self.buf_start = self.buf_idx;
|
||||||
|
},
|
||||||
else => {
|
else => {
|
||||||
self.command.clipboard_contents.kind = c;
|
self.command.clipboard_contents.kind = c;
|
||||||
self.state = .clipboard_kind_end;
|
self.state = .clipboard_kind_end;
|
||||||
@ -580,6 +585,20 @@ test "OSC: get/set clipboard" {
|
|||||||
try testing.expect(std.mem.eql(u8, "?", cmd.clipboard_contents.data));
|
try testing.expect(std.mem.eql(u8, "?", cmd.clipboard_contents.data));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
test "OSC: get/set clipboard (optional parameter)" {
|
||||||
|
const testing = std.testing;
|
||||||
|
|
||||||
|
var p: Parser = .{};
|
||||||
|
|
||||||
|
const input = "52;;?";
|
||||||
|
for (input) |ch| p.next(ch);
|
||||||
|
|
||||||
|
const cmd = p.end().?;
|
||||||
|
try testing.expect(cmd == .clipboard_contents);
|
||||||
|
try testing.expect(cmd.clipboard_contents.kind == 'c');
|
||||||
|
try testing.expect(std.mem.eql(u8, "?", cmd.clipboard_contents.data));
|
||||||
|
}
|
||||||
|
|
||||||
test "OSC: report pwd" {
|
test "OSC: report pwd" {
|
||||||
const testing = std.testing;
|
const testing = std.testing;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user