Code

screen_play: use list_window_check_selected()
authorMax Kellermann <max@duempel.org>
Tue, 23 Sep 2008 11:29:25 +0000 (13:29 +0200)
committerMax Kellermann <max@duempel.org>
Tue, 23 Sep 2008 11:29:25 +0000 (13:29 +0200)
Instead of manually adjusting the selection, let list_window.c do it.

src/screen_play.c

index 625e953d43b4fb6ceed78bd1e606fd47b7a98135..265ca4d10b5057d044d4fdd09981806a3d25e763 100644 (file)
@@ -400,11 +400,7 @@ play_update(screen_t *screen, mpdclient_t *c)
        }
 
        if (c->playlist.id != playlist_id) {
-               if (lw->selected >= c->playlist.list->len)
-                       lw->selected = c->playlist.list->len - 1;
-               if (lw->start >= c->playlist.list->len)
-                       list_window_reset(lw);
-
+               list_window_check_selected(lw, playlist_length(&c->playlist));
                play_paint(screen, c);
                playlist_id = c->playlist.id;
        } else {