We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5391a5b commit d2b5f9fCopy full SHA for d2b5f9f
1 file changed
app/src/main/java/org/schabi/newpipe/ui/components/menu/LongPressMenuEditor.kt
@@ -171,9 +171,9 @@ fun LongPressMenuEditor(modifier: Modifier = Modifier) {
171
} else {
172
var i = rawItem.index
173
// make sure it is not possible to move items in between a *Caption and a HeaderBox
174
- val offsetForRemovingPrev = if (prevDragMarkerIndex < rawItem.index) 1 else 0
175
- if (!items[i - offsetForRemovingPrev].isDraggable) i += 1
176
- if (items[i - offsetForRemovingPrev] == ItemInList.HeaderBox) i += 1
+ if (!items[i].isDraggable) i += 1
+ if (i < items.size && items[i] == ItemInList.HeaderBox) i += 1
+ if (i > rawItem.index && prevDragMarkerIndex < rawItem.index) i -= 1
177
i
178
}
179
0 commit comments