vis
a vi-like editor based on Plan 9's structural regular expressions
git clone https://9o.is/git/vis.git
commit a2a91cf82fb9068ebc889ab0fc18ea37ee074636 parent 6dff861cc1d5f3b06d0bb3b1025367b7915f2c6e Author: zsugabubus <zsugabubus@users.noreply.github.com> Date: Sun, 12 Jan 2020 16:29:00 +0100 vis: don't draw colorcolumn after the end Check for end-of-text. Diffstat:
| M | vis.c | | | 11 | ++++++----- |
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/vis.c b/vis.c @@ -286,17 +286,18 @@ static void window_draw_colorcolumn(Win *win) { if (l->lineno != lineno) { line_cols = 0; line_cc_set = false; - lineno = l->lineno; + if (!(lineno = l->lineno)) + break; } - if (line_cc_set) continue; - line_cols += width; /* This screen line contains the cell we want to highlight */ - if (line_cols >= cc) { - l->cells[(cc - 1) % width].style = style; + if (cc <= line_cols + width) { + l->cells[(cc - 1) - line_cols].style = style; line_cc_set = true; + } else { + line_cols += width; } } }