terminal: active status display
parent
f68ea7c907
commit
9cd4594356
|
|
@ -92,10 +92,13 @@ pub const StatusLineType = enum(u16) {
|
|||
};
|
||||
|
||||
/// The display to target for status updates (DECSASD).
|
||||
pub const StatusDisplay = enum(u16) {
|
||||
main = 0,
|
||||
status_line = 1,
|
||||
};
|
||||
pub const StatusDisplay = lib.Enum(
|
||||
lib_target,
|
||||
&.{
|
||||
"main",
|
||||
"status_line",
|
||||
},
|
||||
);
|
||||
|
||||
/// The possible modify key formats to ESC[>{a};{b}m
|
||||
/// Note: this is not complete, we should add more as we support more
|
||||
|
|
|
|||
|
|
@ -98,6 +98,7 @@ pub const Action = union(Key) {
|
|||
prompt_end,
|
||||
end_of_input,
|
||||
end_hyperlink,
|
||||
active_status_display: ansi.StatusDisplay,
|
||||
decaln,
|
||||
|
||||
pub const Key = lib.Enum(
|
||||
|
|
@ -171,6 +172,7 @@ pub const Action = union(Key) {
|
|||
"prompt_end",
|
||||
"end_of_input",
|
||||
"end_hyperlink",
|
||||
"active_status_display",
|
||||
"decaln",
|
||||
},
|
||||
);
|
||||
|
|
@ -1643,26 +1645,27 @@ pub fn Stream(comptime Handler: type) type {
|
|||
},
|
||||
|
||||
// DECSASD - Select Active Status Display
|
||||
'}' => {
|
||||
const success = decsasd: {
|
||||
// Verify we're getting a DECSASD command
|
||||
if (input.intermediates.len != 1 or input.intermediates[0] != '$')
|
||||
break :decsasd false;
|
||||
if (input.params.len != 1)
|
||||
break :decsasd false;
|
||||
if (!@hasDecl(T, "setActiveStatusDisplay"))
|
||||
break :decsasd false;
|
||||
'}' => decsasd: {
|
||||
// Verify we're getting a DECSASD command
|
||||
if (input.intermediates.len != 1 or input.intermediates[0] != '$') {
|
||||
log.warn("unimplemented CSI callback: {f}", .{input});
|
||||
break :decsasd;
|
||||
}
|
||||
if (input.params.len != 1) {
|
||||
log.warn("unimplemented CSI callback: {f}", .{input});
|
||||
break :decsasd;
|
||||
}
|
||||
|
||||
const display = std.meta.intToEnum(
|
||||
ansi.StatusDisplay,
|
||||
input.params[0],
|
||||
) catch break :decsasd false;
|
||||
|
||||
try self.handler.setActiveStatusDisplay(display);
|
||||
break :decsasd true;
|
||||
const display: ansi.StatusDisplay = switch (input.params[0]) {
|
||||
0 => .main,
|
||||
1 => .status_line,
|
||||
else => {
|
||||
log.warn("unimplemented CSI callback: {f}", .{input});
|
||||
break :decsasd;
|
||||
},
|
||||
};
|
||||
|
||||
if (!success) log.warn("unimplemented CSI callback: {f}", .{input});
|
||||
try self.handler.vt(.active_status_display, display);
|
||||
},
|
||||
|
||||
else => if (@hasDecl(T, "csiUnimplemented"))
|
||||
|
|
|
|||
|
|
@ -297,6 +297,7 @@ pub const StreamHandler = struct {
|
|||
.prompt_end => try self.promptEnd(),
|
||||
.end_of_input => try self.endOfInput(),
|
||||
.end_hyperlink => try self.endHyperlink(),
|
||||
.active_status_display => self.terminal.status_display = value,
|
||||
.decaln => try self.decaln(),
|
||||
|
||||
// Unimplemented
|
||||
|
|
@ -848,13 +849,6 @@ pub const StreamHandler = struct {
|
|||
self.messageWriter(try termio.Message.writeReq(self.alloc, self.enquiry_response));
|
||||
}
|
||||
|
||||
pub fn setActiveStatusDisplay(
|
||||
self: *StreamHandler,
|
||||
req: terminal.StatusDisplay,
|
||||
) !void {
|
||||
self.terminal.status_display = req;
|
||||
}
|
||||
|
||||
pub fn configureCharset(
|
||||
self: *StreamHandler,
|
||||
slot: terminal.CharsetSlot,
|
||||
|
|
|
|||
Loading…
Reference in New Issue