aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2022-05-03 21:54:22 -0700
committerKaz Kylheku <kaz@kylheku.com>2022-05-03 21:54:22 -0700
commite6beaea9003be2fabd5de898d30f5f7c876e2534 (patch)
treea66099ab5ded6b3975bddc36303b5d90d39da2e3
parent39c3e17e5fa989a5db5825ceb9be54ba77c7b92d (diff)
downloadpw-e6beaea9003be2fabd5de898d30f5f7c876e2534.tar.gz
pw-e6beaea9003be2fabd5de898d30f5f7c876e2534.tar.bz2
pw-e6beaea9003be2fabd5de898d30f5f7c876e2534.zip
Don't retrace if there are no lines to draw.
In this case, things go funny because the ANSI escape sequence ^[[0A will still go up one line, in spite of the zero.
-rw-r--r--pw.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/pw.c b/pw.c
index 5d5c5b9..6538cbd 100644
--- a/pw.c
+++ b/pw.c
@@ -446,7 +446,7 @@ static unsigned redraw(char **circbuf, int nlines, unsigned hpos, unsigned hist,
if ((stat & stat_bkgnd))
return stat;
- if (updln) {
+ if (updln && snaplines[hist] > 0) {
printf("\r\033[%dA", snaplines[hist]);
if ((stat & stat_lino) == 0) {
for (int i = 0; i < snaplines[hist]; i++)