terminal: device attributes

pull/9342/head
Mitchell Hashimoto 2025-10-24 07:17:43 -07:00
parent a4a37534d7
commit fd0f9bb843
No known key found for this signature in database
GPG Key ID: 523D5DC389D273BC
2 changed files with 15 additions and 7 deletions

View File

@ -94,6 +94,7 @@ pub const Action = union(Key) {
title_pop: u16,
xtversion,
device_attributes: ansi.DeviceAttributeReq,
device_status: DeviceStatus,
kitty_keyboard_query,
kitty_keyboard_push: KittyKeyboardFlags,
kitty_keyboard_pop: u16,
@ -179,6 +180,7 @@ pub const Action = union(Key) {
"title_pop",
"xtversion",
"device_attributes",
"device_status",
"kitty_keyboard_query",
"kitty_keyboard_push",
"kitty_keyboard_pop",
@ -245,6 +247,16 @@ pub const Action = union(Key) {
col: u16,
};
pub const DeviceStatus = struct {
request: device_status.Request,
pub const C = u16;
pub fn cval(self: DeviceStatus) DeviceStatus.C {
return @bitCast(self.request);
}
};
pub const Mode = struct {
mode: modes.Mode,
@ -1249,11 +1261,6 @@ pub fn Stream(comptime Handler: type) type {
if (input.intermediates.len == 0 or
input.intermediates[0] == '?')
{
if (!@hasDecl(T, "deviceStatusReport")) {
log.warn("unimplemented CSI callback: {f}", .{input});
return;
}
if (input.params.len != 1) {
log.warn("invalid device status report command: {f}", .{input});
return;
@ -1273,7 +1280,7 @@ pub fn Stream(comptime Handler: type) type {
return;
};
try self.handler.deviceStatusReport(req);
try self.handler.vt(.device_status, .{ .request = req });
return;
}

View File

@ -278,6 +278,7 @@ pub const StreamHandler = struct {
.size_report => self.sendSizeReport(value),
.xtversion => try self.reportXtversion(),
.device_attributes => try self.deviceAttributes(value),
.device_status => try self.deviceStatusReport(value.request),
.kitty_keyboard_query => try self.queryKittyKeyboard(),
.kitty_keyboard_push => {
log.debug("pushing kitty keyboard mode: {}", .{value.flags});