make show list a toggle so we don't spam the terminal
This commit is contained in:
parent
c8bd7c057c
commit
4d9e32a36e
|
@ -36,18 +36,39 @@ function delete()
|
|||
end
|
||||
end
|
||||
|
||||
function list_marks()
|
||||
function showList()
|
||||
local delString = "Delete Marks:\n"
|
||||
for _,v in pairs(del_list) do
|
||||
if v:find("\\") then
|
||||
delString = delString..v:match("\\([^\\]*)$").."\n"
|
||||
delString = delString..v:match("\\([^\\]*)$")..";"
|
||||
else
|
||||
delString = delString..v:match("/([^/]*)$").."\n"
|
||||
delString = delString..v:match("/([^/]*)$")..";"
|
||||
end
|
||||
end
|
||||
if delString:find(";") then
|
||||
mp.osd_message(delString)
|
||||
return delString
|
||||
elseif showListTimer then
|
||||
showListTimer:kill()
|
||||
end
|
||||
end
|
||||
local showListTimer = mp.add_periodic_timer(1,showList)
|
||||
showListTimer:kill()
|
||||
function list_marks()
|
||||
if showListTimer:is_enabled() then
|
||||
showListTimer:kill()
|
||||
mp.osd_message("",0)
|
||||
else
|
||||
local delString = showList()
|
||||
showListTimer:resume()
|
||||
if delString and delString:find(";") then
|
||||
print(delString)
|
||||
else
|
||||
showListTimer:kill()
|
||||
end
|
||||
end
|
||||
mp.osd_message(delString)
|
||||
end
|
||||
|
||||
mp.add_key_binding("ctrl+DEL", "delete_file", mark_delete)
|
||||
mp.add_key_binding("alt+DEL", "list_marks", list_marks, {repeatable=true})
|
||||
mp.add_key_binding("alt+DEL", "list_marks", list_marks)
|
||||
mp.register_event("shutdown", delete)
|
||||
|
|
Loading…
Reference in New Issue