diff options
author | wm4 <wm4@nowhere> | 2019-11-21 23:01:56 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2019-11-22 01:15:08 +0100 |
commit | 21f2468d67e11eff7ede0d85fa6f4ab5c4f7de84 (patch) | |
tree | 0eccc529be050bdfe602ccbbcebdc04f4f193e71 /player/lua/defaults.lua | |
parent | eab5457e47389d5eeb79010f2f35e4d6613df86f (diff) | |
download | mpv-21f2468d67e11eff7ede0d85fa6f4ab5c4f7de84.tar.bz2 mpv-21f2468d67e11eff7ede0d85fa6f4ab5c4f7de84.tar.xz |
input: add text produced by key to script key events
Particularly for "any_unicode" mappings, so they don't have to
special-case keys like '#' and ' ', which are normally mapped to
symbolic names for input.conf reasons. (Though admittedly, this is a
pretty minor thing, since API users could map these manually.)
Diffstat (limited to 'player/lua/defaults.lua')
-rw-r--r-- | player/lua/defaults.lua | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/player/lua/defaults.lua b/player/lua/defaults.lua index 127e92036b..38b6a9d04b 100644 --- a/player/lua/defaults.lua +++ b/player/lua/defaults.lua @@ -54,10 +54,10 @@ local function reserve_binding() return "__keybinding" .. tostring(message_id) end -local function dispatch_key_binding(name, state, key_name) +local function dispatch_key_binding(name, state, key_name, key_text) local fn = dispatch_key_bindings[name] if fn then - fn(name, state, key_name) + fn(name, state, key_name, key_text) end end @@ -176,11 +176,15 @@ local function add_binding(attrs, key, name, fn, rp) ["r"] = "repeat", ["p"] = "press", } - key_cb = function(name, state, key_name) + key_cb = function(name, state, key_name, key_text) + if key_text == "" then + key_text = nil + end fn({ event = key_states[state:sub(1, 1)] or "unknown", is_mouse = state:sub(2, 2) == "m", key_name = key_name, + key_text = key_text, }) end msg_cb = function() |