mirror of
https://github.com/luanti-org/luanti.git
synced 2025-09-30 19:22:14 +00:00
Correctly normalize secondary keybindings
This commit is contained in:
parent
f767a7a529
commit
bca82114ae
1 changed files with 12 additions and 1 deletions
|
@ -74,6 +74,17 @@ local function create_rebind_keys_dlg()
|
|||
return dlg
|
||||
end
|
||||
|
||||
local function normalize_key_setting(str)
|
||||
if str == "|" then
|
||||
return core.normalize_keycode(str)
|
||||
end
|
||||
local t = string.split(str, "|")
|
||||
for k, v in pairs(t) do
|
||||
t[k] = core.normalize_keycode(v)
|
||||
end
|
||||
return table.concat(t, "|")
|
||||
end
|
||||
|
||||
function migrate_keybindings(parent)
|
||||
-- Show migration dialog if the user upgraded from an earlier version
|
||||
-- and this has not yet been shown before, *or* if keys settings had to be changed
|
||||
|
@ -86,7 +97,7 @@ function migrate_keybindings(parent)
|
|||
local settings = core.settings:to_table()
|
||||
for name, value in pairs(settings) do
|
||||
if name:match("^keymap_") then
|
||||
local normalized = core.normalize_keycode(value)
|
||||
local normalized = normalize_key_setting(value)
|
||||
if value ~= normalized then
|
||||
has_migration = true
|
||||
core.settings:set(name, normalized)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue