aboutsummaryrefslogtreecommitdiffstats
path: root/pw.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2022-05-06 19:23:26 -0700
committerKaz Kylheku <kaz@kylheku.com>2022-05-06 19:23:26 -0700
commit52c28447cd06bb431837fb289d78280c1957dd47 (patch)
treefb84ebb34e80fe0e3e828a04b6b3bebb71059aab /pw.c
parentf26560794e5f0868c9a5035158b69f3c4af8f7b3 (diff)
downloadpw-52c28447cd06bb431837fb289d78280c1957dd47.tar.gz
pw-52c28447cd06bb431837fb289d78280c1957dd47.tar.bz2
pw-52c28447cd06bb431837fb289d78280c1957dd47.zip
Draw left bars even when there is no left pane.
If there is no left pane, but the middle pane is not showing the beginning of the line (vs2pos is not zero), we need to show the bars to indicate that that is not the start of the line. Otherwise the middle pane looks deceptively as if it were the left pane. In the (vs2pos == 0) case, it doesn't matter; the middle pane shows a prefix, and so is semantically similar to the left pane.
Diffstat (limited to 'pw.c')
-rw-r--r--pw.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/pw.c b/pw.c
index f44ce2a..f7e70ef 100644
--- a/pw.c
+++ b/pw.c
@@ -409,15 +409,17 @@ static void drawline(pwstate *pw, const char *line, int lineno)
int width = vsplit2;
int i = 0;
- if (vsplit1) {
+ if (vsplit1 || vs2pos) {
hlchar(pw, '|');
width--;
}
+
if (vs2pos < olen) {
int nchar = min(olen - vs2pos, width);
- const char *ptr = oline + vs2pos;
+ const char *ptr = oline + vs2pos + i;
for (; i < nchar; i++)
putchar(*ptr++);
+ endmark = 1;
}
for (; i < width; i++)
putchar(' ');