Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix display limit only showing up to half the set size #18

Merged
merged 1 commit into from
Aug 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions mpv-youtube-queue.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 ..
Expand Down