From 4b7d0257d8b029786f95a406e3fc5e080449b478 Mon Sep 17 00:00:00 2001 From: lL1l1 <82986251+lL1l1@users.noreply.github.com> Date: Thu, 30 May 2024 00:43:01 -0700 Subject: [PATCH] Clarify hotbuild keybind collision warning (#6217) --- changelog/snippets/other.6217.md | 1 + lua/keymap/keymapper.lua | 23 ++++++++++++----------- 2 files changed, 13 insertions(+), 11 deletions(-) create mode 100644 changelog/snippets/other.6217.md diff --git a/changelog/snippets/other.6217.md b/changelog/snippets/other.6217.md new file mode 100644 index 0000000000..52e4bbd657 --- /dev/null +++ b/changelog/snippets/other.6217.md @@ -0,0 +1 @@ +- (#6217) Clarify warning when Hotbuild hotkeys collide with other hotkeys. diff --git a/lua/keymap/keymapper.lua b/lua/keymap/keymapper.lua index 8defedfe34..b0fa5c96b2 100644 --- a/lua/keymap/keymapper.lua +++ b/lua/keymap/keymapper.lua @@ -291,18 +291,19 @@ function GenerateHotbuildModifiers() local altModKey = "Alt-" .. key local shiftModBinding = keyDetails[shiftModKey] local altModBinding = keyDetails[altModKey] - if not shiftModBinding and not altModBinding then - modifiers[shiftModKey] = info.action - modifiers[altModKey] = info.action - elseif not shiftModBinding then - modifiers[shiftModKey] = info.action - WARN('Hotbuild key '..altModKey..' is already bound to action "'..altModBinding.name..'" under "'..altModBinding.category..'" category') - elseif not altModBinding then - modifiers[altModKey] = info.action - WARN('Hotbuild key '..shiftModKey..' is already bound to action "'..shiftModBinding.name..'" under "'..shiftModBinding.category..'" category') + + if shiftModBinding then + WARN(string.format('Shift modifier for Hotbuild action "%s" (%s) is already bound to action "%s" (%s)\nThe Shift modifier of the Hotbuild action will not work!' + , info.name, key, shiftModBinding.name, shiftModKey)) else - WARN('Hotbuild key '..shiftModKey..' is already bound to action "'..shiftModBinding.name..'" under "'..shiftModBinding.category..'" category') - WARN('Hotbuild key '..altModKey..' is already bound to action "'..altModBinding.name..'" under "'..altModBinding.category..'" category') + modifiers[shiftModKey] = info.action + end + + if altModBinding then + WARN(string.format('Alt modifier for Hotbuild action "%s" (%s) is already bound to action "%s" (%s)\nThe Alt modifier of the Hotbuild action will not work!' + , info.name, key, altModBinding.name, altModKey)) + else + modifiers[altModKey] = info.action end end end