From 194c199c3f582785e62059bf0a8f7be3be91fe25 Mon Sep 17 00:00:00 2001 From: karlstav Date: Tue, 14 Apr 2020 22:26:28 +0200 Subject: [PATCH] fix #343 noncurses ouptut method vertical offset a new line after last row caused the terminal to start scrolling this was resolved in the past by simply not drawing that row. new fix is to not newline at the last row, but do a return instead --- output/terminal_noncurses.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/output/terminal_noncurses.c b/output/terminal_noncurses.c index bb6cdcf..02e739f 100644 --- a/output/terminal_noncurses.c +++ b/output/terminal_noncurses.c @@ -120,7 +120,7 @@ int draw_terminal_noncurses(int tty, int h, int w, int bars, int bw, int bs, int } } - for (n = h - 2; n >= 0; n--) { + for (n = h - 1; n >= 0; n--) { move = rest; // center adjustment for (o = 0; o < bars; o++) { @@ -161,7 +161,10 @@ int draw_terminal_noncurses(int tty, int h, int w, int bars, int bw, int bs, int move += bs; // move to next bar } - printf("\n"); + if (n != 0) + printf("\n"); + else + printf("\r"); } printf("\033[%dA", h);