From 9cbfa6f0d2e8030ac348cb9c2a8c16e063e41f41 Mon Sep 17 00:00:00 2001 From: shagu Date: Sun, 15 Nov 2020 15:37:50 +0100 Subject: [PATCH] macrotweak: strip macro calls from chat history --- init/modules.xml | 1 + modules/macrotweak.lua | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 modules/macrotweak.lua diff --git a/init/modules.xml b/init/modules.xml index 1ff76551..f62af00a 100644 --- a/init/modules.xml +++ b/init/modules.xml @@ -69,4 +69,5 @@ + diff --git a/modules/macrotweak.lua b/modules/macrotweak.lua new file mode 100644 index 00000000..94a22df2 --- /dev/null +++ b/modules/macrotweak.lua @@ -0,0 +1,20 @@ +pfUI:RegisterModule("macrotweak", "vanilla", function () + -- do not write macro calls into chat input history + if ChatFrameEditBox._AddHistoryLine then + local userinput + ChatFrameEditBox._AddHistoryLine = ChatFrameEditBox.AddHistoryLine + ChatFrameEditBox.AddHistoryLine = function(self, text) + if not userinput and text and string.find(text, "^/run(.+)") then return end + if not userinput and string.find(text, "^/script(.+)") then return end + if not userinput and string.find(text, "^/cast(.+)") then return end + ChatFrameEditBox._AddHistoryLine(self, text) + end + + local OnEnter = ChatFrameEditBox:GetScript("OnEnterPressed") + ChatFrameEditBox:SetScript("OnEnterPressed", function(a1,a2,a3,a4) + userinput = true + OnEnter(a1,a2,a3,a4) + userinput = nil + end) + end +end)