mirror of
https://github.com/ksyasuda/mpv-youtube-queue.git
synced 2024-10-28 04:44:11 -07:00
update move cursor functions to allow holding down key (#11)
This commit is contained in:
parent
a1c2bfd9a7
commit
3814459024
@ -370,24 +370,30 @@ function YouTubeQueue.print_queue(duration)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function YouTubeQueue.move_cursor_up()
|
function YouTubeQueue.move_cursor_up(amt)
|
||||||
if selected_index > 1 then
|
selected_index = selected_index - amt
|
||||||
selected_index = selected_index - 1
|
if selected_index < 1 then
|
||||||
if selected_index < display_offset + 1 then
|
selected_index = 1
|
||||||
display_offset = display_offset - 1
|
elseif selected_index > #video_queue then
|
||||||
end
|
selected_index = #video_queue
|
||||||
YouTubeQueue.print_queue(MSG_DURATION)
|
|
||||||
end
|
end
|
||||||
|
if selected_index > 1 and selected_index < display_offset + 1 then
|
||||||
|
display_offset = display_offset - math.abs(selected_index - amt)
|
||||||
|
end
|
||||||
|
YouTubeQueue.print_queue(MSG_DURATION)
|
||||||
end
|
end
|
||||||
|
|
||||||
function YouTubeQueue.move_cursor_down()
|
function YouTubeQueue.move_cursor_down(amt)
|
||||||
if selected_index < YouTubeQueue.size() then
|
selected_index = selected_index + amt
|
||||||
selected_index = selected_index + 1
|
if selected_index < 1 then
|
||||||
if selected_index > display_offset + display_limit then
|
selected_index = 1
|
||||||
display_offset = display_offset + 1
|
elseif selected_index > #video_queue then
|
||||||
end
|
selected_index = #video_queue
|
||||||
YouTubeQueue.print_queue(MSG_DURATION)
|
|
||||||
end
|
end
|
||||||
|
if selected_index < #video_queue and selected_index > display_offset + display_limit then
|
||||||
|
display_offset = display_offset + math.abs(selected_index - amt)
|
||||||
|
end
|
||||||
|
YouTubeQueue.print_queue(MSG_DURATION)
|
||||||
end
|
end
|
||||||
|
|
||||||
function YouTubeQueue.play_video_at(idx)
|
function YouTubeQueue.play_video_at(idx)
|
||||||
@ -618,9 +624,9 @@ mp.add_key_binding(options.play_previous_in_queue, "play_previous_video",
|
|||||||
YouTubeQueue.play_previous_video)
|
YouTubeQueue.play_previous_video)
|
||||||
mp.add_key_binding(options.print_queue, "print_queue", YouTubeQueue.print_queue)
|
mp.add_key_binding(options.print_queue, "print_queue", YouTubeQueue.print_queue)
|
||||||
mp.add_key_binding(options.move_cursor_up, "move_cursor_up",
|
mp.add_key_binding(options.move_cursor_up, "move_cursor_up",
|
||||||
YouTubeQueue.move_cursor_up, { repeatable = true })
|
function() YouTubeQueue.move_cursor_up(1) end, { repeatable = true })
|
||||||
mp.add_key_binding(options.move_cursor_down, "move_cursor_down",
|
mp.add_key_binding(options.move_cursor_down, "move_cursor_down",
|
||||||
YouTubeQueue.move_cursor_down, { repeatable = true })
|
function() YouTubeQueue.move_cursor_down(1) end, { repeatable = true })
|
||||||
mp.add_key_binding(options.play_selected_video, "play_selected_video",
|
mp.add_key_binding(options.play_selected_video, "play_selected_video",
|
||||||
YouTubeQueue.play_selected_video)
|
YouTubeQueue.play_selected_video)
|
||||||
mp.add_key_binding(options.open_video_in_browser, "open_video_in_browser",
|
mp.add_key_binding(options.open_video_in_browser, "open_video_in_browser",
|
||||||
|
Loading…
Reference in New Issue
Block a user