mirror of
https://github.com/ksyasuda/mpv-youtube-queue.git
synced 2024-11-22 03:19:54 -08:00
fix display limit only showing up to half the set size (#18)
All checks were successful
Luacheck / luacheck (push) Successful in 5s
All checks were successful
Luacheck / luacheck (push) Successful in 5s
This commit is contained in:
parent
392b39c7fc
commit
84a860f596
@ -346,11 +346,17 @@ function YouTubeQueue.print_queue(duration)
|
||||
local ass = assdraw.ass_new()
|
||||
local current_index = index
|
||||
if #video_queue > 0 then
|
||||
local start_index = math.max(1,
|
||||
selected_index - options.display_limit / 2)
|
||||
local end_index = math.min(#video_queue,
|
||||
start_index + options.display_limit - 1)
|
||||
display_offset = start_index - 1
|
||||
local half_limit = math.floor(options.display_limit / 2)
|
||||
local start_index, end_index
|
||||
|
||||
if selected_index <= half_limit then
|
||||
start_index = 1
|
||||
else
|
||||
start_index = selected_index - half_limit
|
||||
end
|
||||
|
||||
end_index = start_index + options.display_limit - 1
|
||||
if end_index > #video_queue then end_index = #video_queue end
|
||||
|
||||
ass:append(
|
||||
style.header .. "MPV-YOUTUBE-QUEUE{\\u0\\b0}" .. style.reset ..
|
||||
|
Loading…
Reference in New Issue
Block a user