From efe0f62b0f5f1c158d9e1ca0ef38554315dec85d Mon Sep 17 00:00:00 2001 From: Joe Vessella Date: Mon, 20 Jun 2022 16:04:11 -0400 Subject: [PATCH 1/5] Added VerboseKeys setting. --- addons/Yush/ReadMe.md | 4 ++++ addons/Yush/Yush.lua | 22 +++++++++++++++++++--- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/addons/Yush/ReadMe.md b/addons/Yush/ReadMe.md index 3a2818ab20..3022167e24 100644 --- a/addons/Yush/ReadMe.md +++ b/addons/Yush/ReadMe.md @@ -29,6 +29,10 @@ The key which resets the current macro set to the previous set. If true, will display the current macro set you are in. The name it displays is the same name it has in the file it loads. +**VerboseKeys** + +If true, will append the list of keybinds for the current macro set. + **VerboseOutput** Determines where the current macro set will be displayed (only effective if the *Verbose* setting is `true`). The following options are available: diff --git a/addons/Yush/Yush.lua b/addons/Yush/Yush.lua index 2797b207d9..9d866d9a80 100644 --- a/addons/Yush/Yush.lua +++ b/addons/Yush/Yush.lua @@ -59,6 +59,7 @@ defaults.ResetKey = '`' defaults.BackKey = 'backspace' defaults.Verbose = false defaults.VerboseOutput = 'Text' +defaults.VerboseKeys = false defaults.Label = {} settings = config.load(defaults) @@ -67,6 +68,7 @@ label = texts.new(settings.Label, settings) binds = {} names = {} +key_combos = {} current = binds stack = L{binds} keys = S{} @@ -75,12 +77,24 @@ output = function() if settings.Verbose then names[current] = names[current] or 'Unnamed ' .. tostring(current):sub(8) + output_text_table = {} + table.insert(output_text_table, names[current]) + if settings.VerboseKeys then + for key, val in pairs(current) do + if type(val) ~= 'string' then + val = names[val] or 'Unnamed' + end + table.insert(output_text_table, key_combos[key] .. ': ' .. val) + end + end + local output_text = table.concat(output_text_table, '\n') + if settings.VerboseOutput == 'Text' then - label:text(names[current]) + label:text(output_text) elseif settings.VerboseOutput == 'Chat' then - log('Changing into macro set %s.':format(names[current])) + log('Changing into macro set %s.':format(output_text)) elseif settings.VerboseOutput == 'Console' then - print('Changing into macro set %s.':format(names[current])) + print('Changing into macro set %s.':format(output_text)) end end end @@ -127,7 +141,9 @@ parse_binds = function(fbinds, top) rawset(names, top, rawget(_innerG._names, fbinds)) for key, val in pairs(fbinds) do + key_combo = key key = S(key:split('+')):map(string.lower) + rawset(key_combos, key, key_combo) if type(val) == 'string' or type(val) == 'function' then rawset(top, key, val) else From b240a1e14bd1c6e57a4296e82797242f9cb92c0d Mon Sep 17 00:00:00 2001 From: Joe Vessella Date: Mon, 20 Jun 2022 16:25:46 -0400 Subject: [PATCH 2/5] Wording update. --- addons/Yush/ReadMe.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/Yush/ReadMe.md b/addons/Yush/ReadMe.md index 3022167e24..2e0adec1e5 100644 --- a/addons/Yush/ReadMe.md +++ b/addons/Yush/ReadMe.md @@ -31,7 +31,7 @@ If true, will display the current macro set you are in. The name it displays is **VerboseKeys** -If true, will append the list of keybinds for the current macro set. +If true, will append the list of keybinds for the current macro set (only effective if the *Verbose* setting is `true`). **VerboseOutput** From 7bce71c2bcefad82ba93c26120862a89dec778f3 Mon Sep 17 00:00:00 2001 From: Joe Vessella Date: Mon, 20 Jun 2022 18:04:33 -0400 Subject: [PATCH 3/5] Removed table identifier. --- addons/Yush/Yush.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/Yush/Yush.lua b/addons/Yush/Yush.lua index 9d866d9a80..544a174cf9 100644 --- a/addons/Yush/Yush.lua +++ b/addons/Yush/Yush.lua @@ -75,7 +75,7 @@ keys = S{} output = function() if settings.Verbose then - names[current] = names[current] or 'Unnamed ' .. tostring(current):sub(8) + names[current] = names[current] or 'Unnamed' output_text_table = {} table.insert(output_text_table, names[current]) From fa2139c02748a9b52a5da05af9f6bbb6deac2991 Mon Sep 17 00:00:00 2001 From: Joe Vessella Date: Mon, 20 Jun 2022 18:07:13 -0400 Subject: [PATCH 4/5] parse_binds no longer reassigns key. --- addons/Yush/Yush.lua | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/addons/Yush/Yush.lua b/addons/Yush/Yush.lua index 544a174cf9..15152a315a 100644 --- a/addons/Yush/Yush.lua +++ b/addons/Yush/Yush.lua @@ -141,14 +141,13 @@ parse_binds = function(fbinds, top) rawset(names, top, rawget(_innerG._names, fbinds)) for key, val in pairs(fbinds) do - key_combo = key - key = S(key:split('+')):map(string.lower) - rawset(key_combos, key, key_combo) + local split_key = S(key:split('+')):map(string.lower) + rawset(key_combos, split_key, key) if type(val) == 'string' or type(val) == 'function' then - rawset(top, key, val) + rawset(top, split_key, val) else local sub = {} - rawset(top, key, sub) + rawset(top, split_key, sub) parse_binds(val, sub) end end From 4d657abf7596a601c9386bf5b4cac106144d981d Mon Sep 17 00:00:00 2001 From: Joe Vessella Date: Mon, 20 Jun 2022 18:09:43 -0400 Subject: [PATCH 5/5] output_text_table renamed, made list, and output text updated. --- addons/Yush/Yush.lua | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/addons/Yush/Yush.lua b/addons/Yush/Yush.lua index 15152a315a..92853f22be 100644 --- a/addons/Yush/Yush.lua +++ b/addons/Yush/Yush.lua @@ -77,24 +77,23 @@ output = function() if settings.Verbose then names[current] = names[current] or 'Unnamed' - output_text_table = {} - table.insert(output_text_table, names[current]) + local output_text_names = L{} + output_text_names:append(names[current]) if settings.VerboseKeys then for key, val in pairs(current) do if type(val) ~= 'string' then val = names[val] or 'Unnamed' end - table.insert(output_text_table, key_combos[key] .. ': ' .. val) + output_text_names:append(key_combos[key] .. ': ' .. val) end end - local output_text = table.concat(output_text_table, '\n') if settings.VerboseOutput == 'Text' then - label:text(output_text) + label:text(output_text_names:concat('\n')) elseif settings.VerboseOutput == 'Chat' then - log('Changing into macro set %s.':format(output_text)) + log('Changing into macro set %s.':format(output_text_names:concat(' | '))) elseif settings.VerboseOutput == 'Console' then - print('Changing into macro set %s.':format(output_text)) + print('Changing into macro set %s.':format(output_text_names:concat(' | '))) end end end