From 648d46d976cf45d3f421dc33e4ffeeb60c3b5361 Mon Sep 17 00:00:00 2001 From: James Whitehead II Date: Sun, 24 Oct 2010 19:51:34 +0100 Subject: [PATCH] Fix modified special keys, like dash and backslash --- Clique.lua | 10 ++-------- Utils.lua | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/Clique.lua b/Clique.lua index 2dd68c0..36c8dce 100755 --- a/Clique.lua +++ b/Clique.lua @@ -440,14 +440,8 @@ function addon:GetBindingAttributes(global) end else -- This is a key binding, so we need a binding for it - local prefix, suffix = addon:GetBindingPrefixSuffix(entry, global) - local key = entry.key - - if key == "DASH" then - key = "-" - elseif key == "BACKSLASH" then - key = "\\" - end + local prefix, suffix = self:GetBindingPrefixSuffix(entry, global) + local key = self:ConvertSpecialKeys(entry) set[#set + 1] = B_SET:format(key, suffix) clr[#clr + 1] = B_CLR:format(key) diff --git a/Utils.lua b/Utils.lua index 706662a..d432f3e 100644 --- a/Utils.lua +++ b/Utils.lua @@ -264,6 +264,21 @@ function addon:GetBindingInfoText(binding) end end +function addon:ConvertSpecialKeys(binding) + if type(binding) ~= "table" or not binding.key then + return "UNKNOWN" + end + + local mods, key = binding.key:match("^(.-)([^%-]+)$") + if key == "DASH" then + key = "-" + elseif key == "BACKSLASH" then + key = "\\" + end + + return tostring(mods) .. tostring(key) +end + function addon:GetBindingPrefixSuffix(binding, global) if type(binding) ~= "table" or not binding.key then return "UNKNOWN", "UNKNOWN" -- 1.7.9.5