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.)
Showing the changes to player/lua/defaults.lua (1 of 7 files). Show all
Unified · Split
| @@ -54,10 +54,10 @@ local function reserve_binding() · 53 unmodified lines | |||
| 54 | return "__keybinding" .. tostring(message_id) | 54 | return "__keybinding" .. tostring(message_id) |
| 55 | end | 55 | end |
| 56 | 56 | ||
| 57 | local function dispatch_key_binding(name, state, key_name) | 57 | local function dispatch_key_binding(name, state, key_name, key_text) |
| 58 | local fn = dispatch_key_bindings[name] | 58 | local fn = dispatch_key_bindings[name] |
| 59 | if fn then | 59 | if fn then |
| 60 | fn(name, state, key_name) | 60 | fn(name, state, key_name, key_text) |
| 61 | end | 61 | end |
| 62 | end | 62 | end |
| 63 | 63 | ||
| @@ -176,11 +176,15 @@ 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, key_name) | 179 | key_cb = function(name, state, key_name, key_text) |
| 180 | if key_text == "" then | ||
| 181 | key_text = nil | ||
| 182 | end | ||
| 180 | fn({ | 183 | fn({ |
| 181 | event = key_states[state:sub(1, 1)] or "unknown", | 184 | event = key_states[state:sub(1, 1)] or "unknown", |
| 182 | is_mouse = state:sub(2, 2) == "m", | 185 | is_mouse = state:sub(2, 2) == "m", |
| 183 | key_name = key_name, | 186 | key_name = key_name, |
| 187 | key_text = key_text, | ||
| 184 | }) | 188 | }) |
| 185 | end | 189 | end |
| 186 | msg_cb = function() | 190 | msg_cb = function() |