From df89dd08e169069c3e1337d179fd7ee2548b2a05 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Wed, 22 Jun 2022 16:37:38 -0700 Subject: [PATCH] support set top/bottom margin with zero params --- src/terminal/Terminal.zig | 5 +++++ src/terminal/stream.zig | 1 + 2 files changed, 6 insertions(+) diff --git a/src/terminal/Terminal.zig b/src/terminal/Terminal.zig index 86f9f37e6..fe1bbc2d3 100644 --- a/src/terminal/Terminal.zig +++ b/src/terminal/Terminal.zig @@ -714,6 +714,11 @@ test "Terminal: setScrollingRegion" { t.setScrollingRegion(7, 3); try testing.expectEqual(@as(usize, 0), t.scrolling_region.top); try testing.expectEqual(@as(usize, t.rows - 1), t.scrolling_region.bottom); + + // Scroll region with zero top and bottom + t.setScrollingRegion(0, 0); + try testing.expectEqual(@as(usize, 0), t.scrolling_region.top); + try testing.expectEqual(@as(usize, t.rows - 1), t.scrolling_region.bottom); } test "Terminal: deleteLines" { diff --git a/src/terminal/stream.zig b/src/terminal/stream.zig index ba262a52f..06c9ecd56 100644 --- a/src/terminal/stream.zig +++ b/src/terminal/stream.zig @@ -327,6 +327,7 @@ pub fn Stream(comptime Handler: type) type { // DECSTBM - Set Top and Bottom Margins // TODO: test 'r' => if (@hasDecl(T, "setTopAndBottomMargin")) switch (action.params.len) { + 0 => try self.handler.setTopAndBottomMargin(0, 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}),