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
5454 return "__keybinding" .. tostring(message_id)
5555 end
5656
57−local function dispatch_key_binding(name, state)
57+local function dispatch_key_binding(name, state, key_name)
5858 local fn = dispatch_key_bindings[name]
5959 if fn then
60− fn(name, state)
60+ fn(name, state, key_name)
6161 end
6262 end
6363
@@ -176,10 +176,11 @@ local function add_binding(attrs, key, name, fn, rp) · 112 unmodified lines
176176 ["r"] = "repeat",
177177 ["p"] = "press",
178178 }
179− key_cb = function(name, state)
179+ key_cb = function(name, state, key_name)
180180 fn({
181181 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,
183184 })
184185 end
185186 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