set top and bottom margins full hookup

This commit is contained in:
Mitchell Hashimoto
2022-05-11 10:11:30 -07:00
parent df7e91a5e5
commit 12ee4ea7e8
2 changed files with 13 additions and 0 deletions

View File

@ -565,6 +565,10 @@ pub fn reverseIndex(self: *Window) !void {
try self.terminal.reverseIndex(self.alloc); try self.terminal.reverseIndex(self.alloc);
} }
pub fn setTopAndBottomMargin(self: *Window, top: u16, bot: u16) !void {
self.terminal.setScrollingRegion(top, bot);
}
pub fn setMode(self: *Window, mode: terminal.Mode, enabled: bool) !void { pub fn setMode(self: *Window, mode: terminal.Mode, enabled: bool) !void {
switch (mode) { switch (mode) {
.origin => { .origin => {

View File

@ -258,6 +258,15 @@ pub fn Stream(comptime Handler: type) type {
} }
} else log.warn("unimplemented CSI callback: {}", .{action}), } else log.warn("unimplemented CSI callback: {}", .{action}),
// DECSTBM - Set Top and Bottom Margins
// TODO: test
'r' => if (@hasDecl(T, "setTopAndBottomMargin")) switch (action.params.len) {
0 => try self.handler.setTopAndBottomMargin(1, 0),
1 => try self.handler.setTopAndBottomMargin(action.params[0], 0),
2 => try self.handler.setTopAndBottomMargin(action.params[0], action.params[1]),
else => log.warn("invalid DECSTBM command: {}", .{action}),
} else log.warn("unimplemented CSI callback: {}", .{action}),
else => if (@hasDecl(T, "csiUnimplemented")) else => if (@hasDecl(T, "csiUnimplemented"))
try self.handler.csiUnimplemented(action) try self.handler.csiUnimplemented(action)
else else