From a82f0d1ce740f60f6c848b8c1e8c2dfb65227ec6 Mon Sep 17 00:00:00 2001 From: adelikat Date: Wed, 27 Nov 2019 20:00:01 -0600 Subject: [PATCH] lua console - hack to keep someone from remove a lua script on accident if the script is highlighted and they press delete in the auto-complete box --- BizHawk.Client.EmuHawk/tools/Lua/LuaConsole.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/BizHawk.Client.EmuHawk/tools/Lua/LuaConsole.cs b/BizHawk.Client.EmuHawk/tools/Lua/LuaConsole.cs index 4324885c1b..db2fa3069c 100644 --- a/BizHawk.Client.EmuHawk/tools/Lua/LuaConsole.cs +++ b/BizHawk.Client.EmuHawk/tools/Lua/LuaConsole.cs @@ -1405,6 +1405,20 @@ namespace BizHawk.Client.EmuHawk } } + // For whatever reason an auto-complete TextBox doesn't respond to delete + // Which is annoying but worse is that it let's the key propagate + // If a script is highlighted in the ListView, and the user presses + // delete, it will remove the script without this hack + protected override bool ProcessCmdKey(ref Message msg, Keys keyData) + { + if (keyData == Keys.Delete && InputBox.Focused) + { + return true; + } + + return base.ProcessCmdKey(ref msg, keyData); + } + protected override bool ProcessTabKey(bool forward) { // TODO: Make me less dirty (please)