aboutsummaryrefslogtreecommitdiff
path: root/vis.c
diff options
context:
space:
mode:
authorzsugabubus <zsugabubus@users.noreply.github.com>2020-01-12 16:29:00 +0100
committerzsugabubus <zsugabubus@users.noreply.github.com>2020-01-12 16:35:43 +0100
commit8b61028df40751f4e9f2098fdb9a17013d7f1c8a (patch)
tree02265bf814f0238a85bbbc8beb92a762248d321f /vis.c
parente136e348cbd0ea4bf2dd8de6f98da1ca1924bc96 (diff)
downloadvis-8b61028df40751f4e9f2098fdb9a17013d7f1c8a.tar.gz
vis-8b61028df40751f4e9f2098fdb9a17013d7f1c8a.tar.xz
vis: don't draw colorcolumn after the end
Check for end-of-text.
Diffstat (limited to 'vis.c')
-rw-r--r--vis.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/vis.c b/vis.c
index 03b01ab..62d6261 100644
--- 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;
}
}
}