Skip to content

Commit

Permalink
always center playlist pos(#54)
Browse files Browse the repository at this point in the history
  • Loading branch information
verygoodlee authored Feb 23, 2024
1 parent d02afff commit bc1c5f0
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/lua/dyn_menu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -378,14 +378,10 @@ local function update_playlist_menu(menu)
if o.max_playlist_items > 0 then
local pos = get('playlist-playing-pos', -1)
if pos == -1 then pos = get('playlist-pos', -1) end
if pos + 1 > o.max_playlist_items then
local mid = math.floor(o.max_playlist_items / 2)
from, to = pos + 1 - mid, pos + (o.max_playlist_items - mid)
if from < 1 then from, to = 1, o.max_playlist_items end
if to > #playlist then from, to = #playlist - o.max_playlist_items + 1, #playlist end
else
from, to = 1, o.max_playlist_items
end
local mid = math.floor(o.max_playlist_items / 2)
from, to = pos + 1 - mid, pos + (o.max_playlist_items - mid)
if from < 1 then from, to = 1, o.max_playlist_items end
if to > #playlist then from, to = #playlist - o.max_playlist_items + 1, #playlist end
end

if from > 1 then
Expand Down

0 comments on commit bc1c5f0

Please sign in to comment.