From ecdca3d66c6ccdb4a43e3c7a2d80f224223bac12 Mon Sep 17 00:00:00 2001 From: Anton Lindqvist Date: Sun, 25 Jun 2017 09:44:55 +0200 Subject: [PATCH] Don't move the cursor upwards if no choices where printed Fixes #98 and #196. --- pick.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pick.c b/pick.c index 8d9199c1..bf09e519 100644 --- a/pick.c +++ b/pick.c @@ -312,7 +312,11 @@ selected_choice(void) err(1, "tty_putc"); tty_putp(clr_eos, 1); tty_putp(tparm(parm_up_cursor, choices_count + 1), 1); - } else { + } else if (choices_count > 0) { + /* + * parm_up_cursor interprets 0 as 1, therefore only move + * upwards if any choices where printed. + */ tty_putp(tparm(parm_up_cursor, choices_count < choices_lines ? choices_count : choices_lines), 1);