summaryrefslogtreecommitdiffstats
path: root/player/lua
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-11-20 23:59:47 +0100
committerwm4 <wm4@nowhere>2014-11-21 00:01:59 +0100
commit00626817c8ac4e91f95141fdc7f8cf39c38f820d (patch)
treec586aeabc6fab9fec6c010f9f377dbd58bb6f498 /player/lua
parent0a78a61d897918c1f013a3d7d308c5a3939c53cc (diff)
downloadmpv-00626817c8ac4e91f95141fdc7f8cf39c38f820d.tar.bz2
mpv-00626817c8ac4e91f95141fdc7f8cf39c38f820d.tar.xz
lua: add a way to add repeatable key bindings
For these, autorepeat is enabled.
Diffstat (limited to 'player/lua')
-rw-r--r--player/lua/defaults.lua8
1 files changed, 5 insertions, 3 deletions
diff --git a/player/lua/defaults.lua b/player/lua/defaults.lua
index 6708f06470..f995dd40d2 100644
--- a/player/lua/defaults.lua
+++ b/player/lua/defaults.lua
@@ -105,8 +105,9 @@ local function update_key_bindings()
local cfg = ""
for k, v in pairs(key_bindings) do
if v.forced ~= def then
- cfg = cfg .. v.key .. " script_message_to " .. mp.script_name
- .. " " .. v.name .. "\n"
+ local flags = (v.repeatable and " repeatable") or ""
+ cfg = cfg .. v.key .. " " .. flags .. " script_message_to "
+ .. mp.script_name .. " " .. v.name .. "\n"
end
end
mp.input_define_section(section, cfg, flags)
@@ -115,12 +116,13 @@ local function update_key_bindings()
end
end
-local function add_binding(attrs, key, name, fn)
+local function add_binding(attrs, key, name, fn, rp)
if (type(name) ~= "string") and (not fn) then
fn = name
name = "message" .. tostring(message_id)
message_id = message_id + 1
end
+ attrs.repeatable = rp == "repeatable"
attrs.key = key
attrs.name = name
key_bindings[name] = attrs