From b42c54e964aa22f5376ff3361e8a176c9515686c Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sat, 25 Jun 2022 11:08:20 -0700 Subject: [PATCH] fix tabstops off by one --- src/terminal/Terminal.zig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/terminal/Terminal.zig b/src/terminal/Terminal.zig index 3e3c8c6a1..dd8c9d7b3 100644 --- a/src/terminal/Terminal.zig +++ b/src/terminal/Terminal.zig @@ -507,7 +507,7 @@ pub fn horizontalTab(self: *Terminal) !void { // If the last cursor position was a tabstop we return. We do // "last cursor position" because we want a space to be written // at the tabstop unless we're at the end (the while condition). - if (self.tabstops.get(self.cursor.x - 1)) return; + if (self.tabstops.get(self.cursor.x)) return; } } @@ -515,7 +515,7 @@ pub fn horizontalTab(self: *Terminal) !void { /// TODO: test pub fn tabClear(self: *Terminal, cmd: csi.TabClear) void { switch (cmd) { - .current => self.tabstops.unset(self.cursor.x - 1), + .current => self.tabstops.unset(self.cursor.x), .all => self.tabstops.reset(0), else => log.warn("invalid or unknown tab clear setting: {}", .{cmd}), } @@ -524,7 +524,7 @@ pub fn tabClear(self: *Terminal, cmd: csi.TabClear) void { /// Set a tab stop on the current cursor. /// TODO: test pub fn tabSet(self: *Terminal) void { - self.tabstops.set(self.cursor.x - 1); + self.tabstops.set(self.cursor.x); } /// Carriage return moves the cursor to the first column.