diff options
Diffstat (limited to 'ui.js')
-rw-r--r-- | ui.js | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/ui.js b/ui.js index de2226a..e78caa9 100644 --- a/ui.js +++ b/ui.js @@ -722,13 +722,31 @@ class AppElement extends FocusElement { } const items = this.queueGrouplike.items + + // If we're unqueueing the item which is currently focused by the cursor, + // just move the cursor ahead. + if (item === focusItem) { + focusItem = items[items.indexOf(focusItem) + 1] + // ...Unless that puts it at past the end of the list, in which case, move + // it behind the item we're removing. + if (!focusItem) { + focusItem = items[items.length - 2] + } + } + if (items.includes(item)) { items.splice(items.indexOf(item), 1) } } + let focusItem = this.queueListingElement.currentItem + recursivelyUnqueueTracks(topItem) this.queueListingElement.buildItems() + + if (focusItem) { + this.queueListingElement.selectAndShow(focusItem) + } } async downloadGrouplikeItem(item) { @@ -1127,9 +1145,8 @@ class GrouplikeListingElement extends Form { if (wasSelected) { if (resetIndex) { - form.curIndex = form.firstItemIndex form.scrollItems = 0 - form.updateSelectedElement() + form.selectInput(form.firstItemIndex) } else { this.root.select(form) } @@ -1171,7 +1188,7 @@ class GrouplikeListingElement extends Form { } selectAndShow(item) { - this.form.selectAndShow(item) + return this.form.selectAndShow(item) } handleJumpValue(value, isConfirm) { @@ -1292,7 +1309,9 @@ class GrouplikeListingForm extends ListScrollForm { this.updateSelectedElement() } this.scrollSelectedElementIntoView() + return true } + return false } } |