aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2022-04-29 04:44:44 -0700
committerKaz Kylheku <kaz@kylheku.com>2022-04-29 04:44:44 -0700
commit32d84fb2925e6f511fb8f8762ee02cb567095215 (patch)
treecd26d25802d043ecfff9b178b18d524d27fa43c6
parent68429e4f41e0691acb37e73f35e42a5d12f5302c (diff)
downloadpw-32d84fb2925e6f511fb8f8762ee02cb567095215.tar.gz
pw-32d84fb2925e6f511fb8f8762ee02cb567095215.tar.bz2
pw-32d84fb2925e6f511fb8f8762ee02cb567095215.zip
Fix shifting position and double showing of < truncation marker.
-rw-r--r--pw.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/pw.c b/pw.c
index e533a5e..a7c62d4 100644
--- a/pw.c
+++ b/pw.c
@@ -248,12 +248,13 @@ static void drawline(const char *line, int hpos, int columns)
line += hpos;
len -= hpos;
putchar('>');
+ columns--;
}
- if (len < (size_t) columns - 1) {
+ if (len < (size_t) columns) {
fputs(line, stdout);
clreol(1);
} else {
- for (int i = 0; i < columns - 2; i++)
+ for (int i = 0; i < columns - 1; i++)
putchar(line[i]);
puts("<");
}