History

lua: report key name for "complex" key bindings

This might make certain use cases less of a mess.

wm4 committed 6 years ago

Commit b08c8f51 parent 13815bf2 files · +9 −7Browse files

Showing the changes to player/lua/defaults.lua (1 of 2 files). Show all

Unified · Split

player/lua/defaults.lua+5−4
@@ -54,10 +54,10 @@ local function reserve_binding() · 53 unmodified lines
54 return "__keybinding" .. tostring(message_id)54 return "__keybinding" .. tostring(message_id)
55end55end
56 56
57local function dispatch_key_binding(name, state)57local function dispatch_key_binding(name, state, key_name)
58 local fn = dispatch_key_bindings[name]58 local fn = dispatch_key_bindings[name]
59 if fn then59 if fn then
60 fn(name, state)60 fn(name, state, key_name)
61 end61 end
62end62end
63 63
@@ -176,10 +176,11 @@ local function add_binding(attrs, key, name, fn, rp) · 112 unmodified lines
176 ["r"] = "repeat",176 ["r"] = "repeat",
177 ["p"] = "press",177 ["p"] = "press",
178 }178 }
179 key_cb = function(name, state)179 key_cb = function(name, state, key_name)
180 fn({180 fn({
181 event = key_states[state:sub(1, 1)] or "unknown",181 event = key_states[state:sub(1, 1)] or "unknown",
182 is_mouse = state:sub(2, 2) == "m"182 is_mouse = state:sub(2, 2) == "m",
183 key = key_name,
183 })184 })
184 end185 end
185 msg_cb = function()186 msg_cb = function()

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t