mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-14 15:56:13 +03:00
terminal: CSI q requires a space intermediate
This commit is contained in:
@ -15,6 +15,4 @@ pub const Wasm = if (!builtin.target.isWasm()) struct {} else @import("config/Wa
|
||||
|
||||
test {
|
||||
@import("std").testing.refAllDecls(@This());
|
||||
|
||||
_ = @import("config/c_get.zig");
|
||||
}
|
||||
|
@ -721,6 +721,32 @@ test "csi: request mode decrqm" {
|
||||
}
|
||||
}
|
||||
|
||||
test "csi: change cursor" {
|
||||
var p = init();
|
||||
_ = p.next(0x1B);
|
||||
for ("[3 ") |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('q');
|
||||
try testing.expect(p.state == .ground);
|
||||
try testing.expect(a[0] == null);
|
||||
try testing.expect(a[1].? == .csi_dispatch);
|
||||
try testing.expect(a[2] == null);
|
||||
|
||||
const d = a[1].?.csi_dispatch;
|
||||
try testing.expect(d.final == 'q');
|
||||
try testing.expectEqual(@as(usize, 1), d.intermediates.len);
|
||||
try testing.expectEqual(@as(usize, 1), d.params.len);
|
||||
try testing.expectEqual(@as(u16, ' '), d.intermediates[0]);
|
||||
try testing.expectEqual(@as(u16, 3), d.params[0]);
|
||||
}
|
||||
}
|
||||
|
||||
test "osc: change window title" {
|
||||
var p = init();
|
||||
_ = p.next(0x1B);
|
||||
|
@ -600,16 +600,33 @@ pub fn Stream(comptime Handler: type) type {
|
||||
|
||||
// DECSCUSR - Select Cursor Style
|
||||
// TODO: test
|
||||
'q' => if (@hasDecl(T, "setCursorStyle")) try self.handler.setCursorStyle(
|
||||
switch (action.params.len) {
|
||||
0 => ansi.CursorStyle.default,
|
||||
1 => @enumFromInt(action.params[0]),
|
||||
else => {
|
||||
log.warn("invalid set curor style command: {}", .{action});
|
||||
return;
|
||||
},
|
||||
'q' => switch (action.intermediates.len) {
|
||||
1 => cursor: {
|
||||
if (action.intermediates[0] != ' ') {
|
||||
log.warn(
|
||||
"ignoring unimplemented CSI q with intermediates: {s}",
|
||||
.{action.intermediates},
|
||||
);
|
||||
break :cursor;
|
||||
}
|
||||
|
||||
if (@hasDecl(T, "setCursorStyle")) try self.handler.setCursorStyle(
|
||||
switch (action.params.len) {
|
||||
0 => ansi.CursorStyle.default,
|
||||
1 => @enumFromInt(action.params[0]),
|
||||
else => {
|
||||
log.warn("invalid set curor style command: {}", .{action});
|
||||
return;
|
||||
},
|
||||
},
|
||||
) else log.warn("unimplemented CSI callback: {}", .{action});
|
||||
},
|
||||
) else log.warn("unimplemented CSI callback: {}", .{action}),
|
||||
|
||||
else => log.warn(
|
||||
"ignoring unimplemented CSI p with intermediates: {s}",
|
||||
.{action.intermediates},
|
||||
),
|
||||
},
|
||||
|
||||
'r' => switch (action.intermediates.len) {
|
||||
// DECSTBM - Set Top and Bottom Margins
|
||||
|
Reference in New Issue
Block a user