mirror of
https://github.com/luanti-org/luanti.git
synced 2026-01-01 02:45:19 +01:00
Show proper default key name in reset tooltip on keybindings menu (#16777)
* implement 'core.scancode_to_keyname()' and use it to fix something * fix whitespaces and fix another thing * ._. * lol * rename to get_key_description * add case for keybindings whose defaults are not bound * apply y5nw's suggestions * lmao I'm so dumb
This commit is contained in:
@@ -616,6 +616,14 @@ local function get_formspec(dialogdata)
|
||||
|
||||
if show_reset then
|
||||
local default = comp.setting.default
|
||||
if comp.setting.type == "key" then
|
||||
default = (default ~= "")
|
||||
and core.get_key_description(default)
|
||||
|
||||
--~ Indicates that the action does not have a corresponding keybinding.
|
||||
or fgettext_ne("Not bound")
|
||||
end
|
||||
|
||||
local reset_tooltip = default and
|
||||
fgettext("Reset setting to default ($1)", tostring(default)) or
|
||||
fgettext("Reset setting to default")
|
||||
|
||||
Reference in New Issue
Block a user