From: Max Kellermann Date: Tue, 25 Nov 2008 17:44:42 +0000 (+0100) Subject: list_window: reset cursor when list is empty X-Git-Tag: v0.12_beta1~11 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=b320d4d5c6824732a968cd3d5ab547f82e7ae315;p=ncmpc.git 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. --- 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; }