mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 08:46:08 +03:00
terminal: DCS parses params correctly
This commit is contained in:
@ -266,12 +266,19 @@ pub fn next(self: *Parser, c: u8) [3]?Action {
|
|||||||
self.osc_parser.reset();
|
self.osc_parser.reset();
|
||||||
break :osc_string null;
|
break :osc_string null;
|
||||||
},
|
},
|
||||||
.dcs_passthrough => Action{
|
.dcs_passthrough => dcs_hook: {
|
||||||
.dcs_hook = .{
|
// Finalize parameters
|
||||||
.intermediates = self.intermediates[0..self.intermediates_idx],
|
if (self.param_acc_idx > 0) {
|
||||||
.params = self.params[0..self.params_idx],
|
self.params[self.params_idx] = self.param_acc;
|
||||||
.final = c,
|
self.params_idx += 1;
|
||||||
},
|
}
|
||||||
|
break :dcs_hook .{
|
||||||
|
.dcs_hook = .{
|
||||||
|
.intermediates = self.intermediates[0..self.intermediates_idx],
|
||||||
|
.params = self.params[0..self.params_idx],
|
||||||
|
.final = c,
|
||||||
|
},
|
||||||
|
};
|
||||||
},
|
},
|
||||||
.sos_pm_apc_string => Action{ .apc_start = {} },
|
.sos_pm_apc_string => Action{ .apc_start = {} },
|
||||||
else => null,
|
else => null,
|
||||||
@ -792,3 +799,26 @@ test "csi: too many params" {
|
|||||||
try testing.expect(a[2] == null);
|
try testing.expect(a[2] == null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
test "dcs" {
|
||||||
|
var p = init();
|
||||||
|
_ = p.next(0x1B);
|
||||||
|
for ("P1000") |c| {
|
||||||
|
const a = p.next(c);
|
||||||
|
try testing.expect(a[0] == null);
|
||||||
|
try testing.expect(a[1] == null);
|
||||||
|
try testing.expect(a[2] == null);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
const a = p.next('p');
|
||||||
|
try testing.expect(p.state == .dcs_passthrough);
|
||||||
|
try testing.expect(a[0] == null);
|
||||||
|
try testing.expect(a[1] == null);
|
||||||
|
try testing.expect(a[2].? == .dcs_hook);
|
||||||
|
|
||||||
|
const hook = a[2].?.dcs_hook;
|
||||||
|
try testing.expectEqualSlices(u16, &[_]u16{1000}, hook.params);
|
||||||
|
try testing.expectEqual('p', hook.final);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user