fix(termio/exec): avoid overflow in setCursorRow/ColRelative

Using a saturating addition here just to avoid overflow, since setCursorPos handles proper clamping to the screen size so we don't need to duplicate that logic.
This commit is contained in:
Qwerasd
2024-03-29 13:15:24 -04:00
parent 20ab4ec01f
commit 4c9e238c3f

View File

@ -1993,7 +1993,7 @@ const StreamHandler = struct {
pub fn setCursorColRelative(self: *StreamHandler, offset: u16) !void { pub fn setCursorColRelative(self: *StreamHandler, offset: u16) !void {
self.terminal.setCursorPos( self.terminal.setCursorPos(
self.terminal.screen.cursor.y + 1, self.terminal.screen.cursor.y + 1,
self.terminal.screen.cursor.x + 1 + offset, self.terminal.screen.cursor.x + 1 +| offset,
); );
} }
@ -2003,7 +2003,7 @@ const StreamHandler = struct {
pub fn setCursorRowRelative(self: *StreamHandler, offset: u16) !void { pub fn setCursorRowRelative(self: *StreamHandler, offset: u16) !void {
self.terminal.setCursorPos( self.terminal.setCursorPos(
self.terminal.screen.cursor.y + 1 + offset, self.terminal.screen.cursor.y + 1 +| offset,
self.terminal.screen.cursor.x + 1, self.terminal.screen.cursor.x + 1,
); );
} }