From 12ee4ea7e8946535709715f4d6f1515fcd0e39b2 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Wed, 11 May 2022 10:11:30 -0700 Subject: [PATCH] set top and bottom margins full hookup --- src/Window.zig | 4 ++++ src/terminal/stream.zig | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/src/Window.zig b/src/Window.zig index c1f8f2484..79f865de3 100644 --- a/src/Window.zig +++ b/src/Window.zig @@ -565,6 +565,10 @@ pub fn reverseIndex(self: *Window) !void { 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 { switch (mode) { .origin => { diff --git a/src/terminal/stream.zig b/src/terminal/stream.zig index 321bc58ac..0268ada8f 100644 --- a/src/terminal/stream.zig +++ b/src/terminal/stream.zig @@ -258,6 +258,15 @@ pub fn Stream(comptime Handler: type) type { } } 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")) try self.handler.csiUnimplemented(action) else