summaryrefslogtreecommitdiffstats
path: root/player
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-11-24 16:47:03 +0100
committerwm4 <wm4@nowhere>2014-11-24 16:47:03 +0100
commit89c1525585aae363dc57bd1e4510de8e6da2f480 (patch)
treeb7a57446111cec8330436b05ee05020a7918996e /player
parent2a017734a53886568aafc2515b291bd96253e4dc (diff)
downloadmpv-89c1525585aae363dc57bd1e4510de8e6da2f480.tar.bz2
mpv-89c1525585aae363dc57bd1e4510de8e6da2f480.tar.xz
lua: always handle key repeat on the script side
Simpler, and leaves the decision to repeat or not fully to the script (instead of requiring the user to care about it when remapping a script binding).
Diffstat (limited to 'player')
-rw-r--r--player/lua/defaults.lua9
1 files changed, 5 insertions, 4 deletions
diff --git a/player/lua/defaults.lua b/player/lua/defaults.lua
index 7e038dfbb8..55f5bddf39 100644
--- a/player/lua/defaults.lua
+++ b/player/lua/defaults.lua
@@ -75,7 +75,7 @@ function mp.set_key_bindings(list, section, flags)
local is_mouse = state:sub(2, 2) == "m"
local def = (is_mouse and "u") or "d"
if event == "r" then
- event = "d"
+ return
end
if event == "p" and cb then
cb()
@@ -142,9 +142,7 @@ local function add_binding(attrs, key, name, fn, rp)
name = reserve_binding()
end
local bind = key
- if rp == "repeatable" or rp["repeatable"] then
- bind = bind .. " repeatable"
- end
+ local repeatable = rp == "repeatable" or rp["repeatable"]
if rp["forced"] then
attrs.forced = true
end
@@ -176,6 +174,9 @@ local function add_binding(attrs, key, name, fn, rp)
-- Also, key repeat triggers the binding again.
local event = state:sub(1, 1)
local is_mouse = state:sub(2, 2) == "m"
+ if event == "r" and not repeatable then
+ return
+ end
if is_mouse and event == "u" then
fn()
elseif (not is_mouse) and (event == "d" or event == "r") then