Skip to content

Commit bc1c5f0

Browse files
authored
always center playlist pos(#54)
1 parent d02afff commit bc1c5f0

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

src/lua/dyn_menu.lua

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -378,14 +378,10 @@ local function update_playlist_menu(menu)
378378
if o.max_playlist_items > 0 then
379379
local pos = get('playlist-playing-pos', -1)
380380
if pos == -1 then pos = get('playlist-pos', -1) end
381-
if pos + 1 > o.max_playlist_items then
382-
local mid = math.floor(o.max_playlist_items / 2)
383-
from, to = pos + 1 - mid, pos + (o.max_playlist_items - mid)
384-
if from < 1 then from, to = 1, o.max_playlist_items end
385-
if to > #playlist then from, to = #playlist - o.max_playlist_items + 1, #playlist end
386-
else
387-
from, to = 1, o.max_playlist_items
388-
end
381+
local mid = math.floor(o.max_playlist_items / 2)
382+
from, to = pos + 1 - mid, pos + (o.max_playlist_items - mid)
383+
if from < 1 then from, to = 1, o.max_playlist_items end
384+
if to > #playlist then from, to = #playlist - o.max_playlist_items + 1, #playlist end
389385
end
390386

391387
if from > 1 then

0 commit comments

Comments
 (0)