implement DECSASD by just blackholing the output for now

We don't want to support status lines, and if anything sends us status
line information we don't want it to mess up the main display, so just
drop it.
This commit is contained in:
Mitchell Hashimoto
2022-08-02 11:03:01 -07:00
parent 2b80699179
commit 40cec18943
5 changed files with 56 additions and 0 deletions

View File

@ -925,3 +925,10 @@ pub fn restoreCursor(self: *Window) !void {
pub fn enquiry(self: *Window) !void { pub fn enquiry(self: *Window) !void {
try self.queueWrite(""); try self.queueWrite("");
} }
pub fn setActiveStatusDisplay(
self: *Window,
req: terminal.StatusDisplay,
) !void {
self.terminal.status_display = req;
}

View File

@ -35,6 +35,11 @@ active_screen: ScreenType,
screen: Screen, screen: Screen,
secondary_screen: Screen, secondary_screen: Screen,
/// Whether we're currently writing to the status line (DECSASD and DECSSDT).
/// We don't support a status line currently so we just black hole this
/// data so that it doesn't mess up our main display.
status_display: ansi.StatusDisplay = .main,
/// Where the tabstops are. /// Where the tabstops are.
tabstops: Tabstops, tabstops: Tabstops,
@ -303,6 +308,9 @@ pub fn print(self: *Terminal, c: u21) !void {
const tracy = trace(@src()); const tracy = trace(@src());
defer tracy.end(); defer tracy.end();
// If we're not on the main display, do nothing for now
if (self.status_display != .main) return;
// If we're not at the bottom, then we need to move there // If we're not at the bottom, then we need to move there
if (!self.screen.displayIsBottom()) self.screen.scroll(.{ .bottom = {} }); if (!self.screen.displayIsBottom()) self.screen.scroll(.{ .bottom = {} });

View File

@ -115,3 +115,22 @@ pub const CursorStyle = enum(u16) {
}; };
} }
}; };
/// The status line type for DECSSDT.
pub const StatusLineType = enum(u16) {
none = 0,
indicator = 1,
host_writable = 2,
// Non-exhaustive so that @intToEnum never fails for unsupported values.
_,
};
/// The display to target for status updates (DECSASD).
pub const StatusDisplay = enum(u16) {
main = 0,
status_line = 1,
// Non-exhaustive so that @intToEnum never fails for unsupported values.
_,
};

View File

@ -11,6 +11,8 @@ pub const CursorStyle = ansi.CursorStyle;
pub const DeviceAttributeReq = ansi.DeviceAttributeReq; pub const DeviceAttributeReq = ansi.DeviceAttributeReq;
pub const DeviceStatusReq = ansi.DeviceStatusReq; pub const DeviceStatusReq = ansi.DeviceStatusReq;
pub const Mode = ansi.Mode; pub const Mode = ansi.Mode;
pub const StatusLineType = ansi.StatusLineType;
pub const StatusDisplay = ansi.StatusDisplay;
pub const EraseDisplay = csi.EraseDisplay; pub const EraseDisplay = csi.EraseDisplay;
pub const EraseLine = csi.EraseLine; pub const EraseLine = csi.EraseLine;
pub const TabClear = csi.TabClear; pub const TabClear = csi.TabClear;

View File

@ -382,6 +382,26 @@ pub fn Stream(comptime Handler: type) type {
1 => try self.handler.insertBlanks(action.params[0]), 1 => try self.handler.insertBlanks(action.params[0]),
else => log.warn("invalid ICH command: {}", .{action}), else => log.warn("invalid ICH command: {}", .{action}),
} else log.warn("unimplemented CSI callback: {}", .{action}), } else log.warn("unimplemented CSI callback: {}", .{action}),
// DECSASD - Select Active Status Display
'}' => {
const success = decsasd: {
// Verify we're getting a DECSASD command
if (action.intermediates.len != 1 or action.intermediates[0] != '$')
break :decsasd false;
if (action.params.len != 1)
break :decsasd false;
if (!@hasDecl(T, "setActiveStatusDisplay"))
break :decsasd false;
try self.handler.setActiveStatusDisplay(
@intToEnum(ansi.StatusDisplay, action.params[0]),
);
break :decsasd true;
};
if (!success) log.warn("unimplemented CSI callback: {}", .{action});
},
} }
} }