fix: render highlight columns only based on the absolute column

closes #392
This commit is contained in:
CJ van den Berg 2025-12-16 16:23:52 +01:00
parent b52b06735b
commit 44a48510fd
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9

View file

@ -1279,18 +1279,18 @@ pub const Editor = struct {
const hl_cols: []const u16 = tui.highlight_columns(); const hl_cols: []const u16 = tui.highlight_columns();
const alpha: u8 = tui.config().highlight_columns_alpha; const alpha: u8 = tui.config().highlight_columns_alpha;
const offset = self.view.col; const offset = self.view.col;
for (hl_cols) |hl_col_| { for (hl_cols) |hl_col| {
if (hl_col_ < offset) continue; if (hl_col > (self.view.cols + offset)) continue;
const hl_col = hl_col_ - offset; for (0..self.view.rows) |row| for (0..self.view.cols) |col| {
if (hl_col > self.view.cols) continue; const view_col = col + offset;
for (0..self.view.rows) |row| for (0..self.view.cols) |col| if (hl_col <= view_col) {
if (hl_col > 0 and hl_col <= col) {
self.plane.cursor_move_yx(@intCast(row), @intCast(col)) catch return; self.plane.cursor_move_yx(@intCast(row), @intCast(col)) catch return;
var cell = self.plane.cell_init(); var cell = self.plane.cell_init();
_ = self.plane.at_cursor_cell(&cell) catch return; _ = self.plane.at_cursor_cell(&cell) catch return;
cell.dim_bg(alpha); cell.dim_bg(alpha);
_ = self.plane.putc(&cell) catch {}; _ = self.plane.putc(&cell) catch {};
}; }
};
} }
} }