From 73ecb6f7ee7f5358f367bd4e2e16551424332294 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Tue, 10 Oct 2023 15:26:04 -0700 Subject: [PATCH] terminal: CUL handles left/right margins --- src/terminal/Terminal.zig | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/terminal/Terminal.zig b/src/terminal/Terminal.zig index b4a2c1a8b..1203db260 100644 --- a/src/terminal/Terminal.zig +++ b/src/terminal/Terminal.zig @@ -1329,12 +1329,13 @@ pub fn cursorLeft(self: *Terminal, count_req: usize) void { } // The margins we can move to. - // TODO: if cursor is left of the left margin, assume left margin to be 0. - // verified with xterm. don't forget when left margins are implemented! - const left_margin = 0; - const right_margin = self.cols - 1; const top = self.scrolling_region.top; const bottom = self.scrolling_region.bottom; + const right_margin = self.scrolling_region.right; + const left_margin = if (self.screen.cursor.x < self.scrolling_region.left) + 0 + else + self.scrolling_region.left; while (true) { // We can move at most to the left margin.