From e6beaea9003be2fabd5de898d30f5f7c876e2534 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Tue, 3 May 2022 21:54:22 -0700 Subject: 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. --- pw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'pw.c') 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++) -- cgit v1.2.3