summaryrefslogtreecommitdiffstats
path: root/player
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-03-26 10:44:57 +0100
committerwm4 <wm4@nowhere>2016-03-26 10:44:57 +0100
commit32fde273d371c834e96010d5944555b84d9d6225 (patch)
treea7ff74b12bee39520351e6fd6b0a7c59676d7b87 /player
parent5843392db5691403345074b24c9b3caae468d4c6 (diff)
downloadmpv-32fde273d371c834e96010d5944555b84d9d6225.tar.bz2
mpv-32fde273d371c834e96010d5944555b84d9d6225.tar.xz
lua: don't require key for mp.add_key_binding()
Requested. The intention is that scripts can provide mappable actions for key bindings without setting a default key.
Diffstat (limited to 'player')
-rw-r--r--player/lua/defaults.lua7
1 files changed, 4 insertions, 3 deletions
diff --git a/player/lua/defaults.lua b/player/lua/defaults.lua
index 38905a610b..a12e5bd3c3 100644
--- a/player/lua/defaults.lua
+++ b/player/lua/defaults.lua
@@ -145,7 +145,7 @@ local function update_key_bindings()
end
local cfg = ""
for k, v in pairs(key_bindings) do
- if v.forced ~= def then
+ if v.bind and v.forced ~= def then
cfg = cfg .. v.bind .. "\n"
end
end
@@ -161,7 +161,6 @@ local function add_binding(attrs, key, name, fn, rp)
fn = name
name = reserve_binding()
end
- local bind = key
local repeatable = rp == "repeatable" or rp["repeatable"]
if rp["forced"] then
attrs.forced = true
@@ -205,7 +204,9 @@ local function add_binding(attrs, key, name, fn, rp)
end
msg_cb = fn
end
- attrs.bind = bind .. " script-binding " .. mp.script_name .. "/" .. name
+ if key and #key > 0 then
+ attrs.bind = key .. " script-binding " .. mp.script_name .. "/" .. name
+ end
attrs.name = name
key_bindings[name] = attrs
update_key_bindings()