Code

screen_play: move selection when moving a single song in playlist
authorjefromi <jefromi@gmail.com>
Thu, 12 Feb 2009 14:34:00 +0000 (15:34 +0100)
committerMax Kellermann <max@duempel.org>
Sun, 15 Feb 2009 16:19:23 +0000 (17:19 +0100)
Selection didn't move when moving a single song in playlist.
Introduced by the visual selection - selection is only updated when
moving in visual mode, not when moving a single song (nonvisual
mode).

src/screen_play.c

index 75b0f2edad5f03ce31912b66b40d2374b495ad43..c69f64c220324264874c862a0dbef60e71e16187 100644 (file)
@@ -624,7 +624,12 @@ play_cmd(mpdclient_t *c, command_t cmd)
                        lw->visual_base--;
                }
                else
+               {
                        mpdclient_cmd_move(c, lw->selected, lw->selected-1);
+                       lw->selected--;
+                       lw->selected_start--;
+                       lw->selected_end--;
+               }
                return true;
        case CMD_LIST_MOVE_DOWN:
                if(lw->selected_end+1 >= playlist_length(&c->playlist))
@@ -641,7 +646,12 @@ play_cmd(mpdclient_t *c, command_t cmd)
                        lw->visual_base++;
                }
                else
+               {
                        mpdclient_cmd_move(c, lw->selected, lw->selected+1);
+                       lw->selected++;
+                       lw->selected_start++;
+                       lw->selected_end++;
+               }
                return true;
        case CMD_LIST_FIND:
        case CMD_LIST_RFIND: