From b320d4d5c6824732a968cd3d5ab547f82e7ae315 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 25 Nov 2008 18:44:42 +0100 Subject: [PATCH] list_window: reset cursor when list is empty Due to a side effect of the old "if" condition, the cursor was never reset to the origin when the list was cleared. --- src/list_window.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/list_window.c b/src/list_window.c index efb6101..9f34f53 100644 --- a/src/list_window.c +++ b/src/list_window.c @@ -73,7 +73,9 @@ list_window_check_selected(struct list_window *lw, unsigned length) if (lw->selected < lw->start) lw->selected = lw->start; - if (length > 0 && lw->selected >= length) + if (length == 0) + lw->selected = 0; + else if (lw->selected >= length) lw->selected = length - 1; } -- 2.30.2