diff options
author | Max Kellermann <max@duempel.org> | 2008-11-25 18:44:42 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2008-11-25 18:44:42 +0100 |
commit | b320d4d5c6824732a968cd3d5ab547f82e7ae315 (patch) | |
tree | 5992bd19ee6beb1fef26ad154da81c9ebdb5a82e /src/list_window.c | |
parent | 2193aa81c5a8508ef8aaa1dd82f5dd0609d1860a (diff) | |
download | mpd-b320d4d5c6824732a968cd3d5ab547f82e7ae315.tar.gz mpd-b320d4d5c6824732a968cd3d5ab547f82e7ae315.tar.xz mpd-b320d4d5c6824732a968cd3d5ab547f82e7ae315.zip |
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.
Diffstat (limited to 'src/list_window.c')
-rw-r--r-- | src/list_window.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/list_window.c b/src/list_window.c index efb610117..9f34f539f 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; } |