From 4dce4ad9940a622246514e893916b16e6b8797ea Mon Sep 17 00:00:00 2001 From: CJ van den Berg Date: Tue, 11 Feb 2025 09:58:26 +0100 Subject: [PATCH] fix(gutter): prevent integer overlow if view top moves past file end in relative numbering mode --- src/tui/editor_gutter.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tui/editor_gutter.zig b/src/tui/editor_gutter.zig index 80f2560..04bae89 100644 --- a/src/tui/editor_gutter.zig +++ b/src/tui/editor_gutter.zig @@ -195,7 +195,7 @@ pub fn render_relative(self: *Self, theme: *const Widget.Theme) void { var rows = self.view_rows; var diff_symbols = self.diff_symbols.items; while (rows > 0) : (rows -= 1) { - if (pos > self.lines - @as(u32, @intCast(row))) return; + if (self.lines > @as(u32, @intCast(row)) and pos > self.lines - @as(u32, @intCast(row))) return; self.plane.set_style(if (linenum == 0) theme.editor_gutter_active else theme.editor_gutter); const val = @abs(if (linenum == 0) line else linenum);