Code

screen_queue: fix CMD_LIST_MOVE_*
authorJonathan Neuschäfer <j.neuschaefer@gmx.net>
Sat, 17 Sep 2011 20:16:50 +0000 (22:16 +0200)
committerJonathan Neuschäfer <j.neuschaefer@gmx.net>
Sat, 17 Sep 2011 20:16:50 +0000 (22:16 +0200)
The code now tries to keep as much as possible of the selection being
moved visible.

src/screen_queue.c

index 37a60500eea74a6006237af072d93bcfe68a8d76..335bb17265f27a636eb93be976cd29d660d5fa13 100644 (file)
@@ -765,6 +765,10 @@ screen_queue_cmd(struct mpdclient *c, command_t cmd)
                lw->selected--;
                lw->range_base--;
 
+               if (lw->range_selection)
+                       list_window_scroll_to(lw, lw->range_base);
+               list_window_scroll_to(lw, lw->selected);
+
                screen_queue_save_selection();
                return true;
 
@@ -779,6 +783,10 @@ screen_queue_cmd(struct mpdclient *c, command_t cmd)
                lw->selected++;
                lw->range_base++;
 
+               if (lw->range_selection)
+                       list_window_scroll_to(lw, lw->range_base);
+               list_window_scroll_to(lw, lw->selected);
+
                screen_queue_save_selection();
                return true;