support DECCOLM

This gets vttest page 1 and page 2 now FULL passing.

We now crash on page 3. This is a lingering bug in our grid code
though and we need to find it anyways so we'll keep the crash in.
This commit is contained in:
Mitchell Hashimoto
2022-07-24 16:06:04 -07:00
parent a3409ac70d
commit 5c8c9d8e3c
5 changed files with 65 additions and 20 deletions

View File

@@ -809,23 +809,20 @@ pub fn setMode(self: *Window, mode: terminal.Mode, enabled: bool) !void {
.bracketed_paste => self.bracketed_paste = true,
.enable_mode_3 => self.terminal.modes.enable_mode_3 = @boolToInt(enabled),
.@"132_column" => mode3: {
// TODO: test this
.enable_mode_3 => {
// Disable deccolm
self.terminal.setDeccolmSupported(enabled);
// Do nothing if "enable mode 3" is not set.
if (self.terminal.modes.enable_mode_3 == 0) break :mode3;
// Set it
self.terminal.modes.@"132_column" = @boolToInt(enabled);
// TODO: do not clear screen flag mode
self.terminal.eraseDisplay(.complete);
self.terminal.setCursorPos(1, 1);
// TODO: left/right margins
// Force resize back to the window size
self.terminal.resize(self.alloc, self.grid.size.columns, self.grid.size.rows) catch |err|
log.err("error updating terminal size: {}", .{err});
},
.@"132_column" => try self.terminal.deccolm(
self.alloc,
if (enabled) .@"132_cols" else .@"80_cols",
),
else => if (enabled) log.warn("unimplemented mode: {}", .{mode}),
}
}