From ddef661eb218a5ef637967a34ad396be171e79fc Mon Sep 17 00:00:00 2001 From: YoshiRulz Date: Thu, 25 Mar 2021 15:30:43 +1000 Subject: [PATCH] Move attaching of callbacks from LuaConsole_Load to Restart Y'know, where the thing they're being passed to is created... I don't think them only being attached once was a problem, as one is also called from elsewhere and the other is kinda useless --- src/BizHawk.Client.EmuHawk/tools/Lua/LuaConsole.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/BizHawk.Client.EmuHawk/tools/Lua/LuaConsole.cs b/src/BizHawk.Client.EmuHawk/tools/Lua/LuaConsole.cs index bc194eaffb..c67801fb28 100644 --- a/src/BizHawk.Client.EmuHawk/tools/Lua/LuaConsole.cs +++ b/src/BizHawk.Client.EmuHawk/tools/Lua/LuaConsole.cs @@ -166,8 +166,6 @@ namespace BizHawk.Client.EmuHawk Settings = new LuaConsoleSettings(); } - LuaImp.ScriptList.ChangedCallback = SessionChangedCallback; - if (Config.RecentLuaSession.AutoLoad && !Config.RecentLuaSession.Empty) { LoadSessionFromRecent(Config.RecentLuaSession.MostRecent); @@ -196,7 +194,6 @@ namespace BizHawk.Client.EmuHawk SetColumns(); splitContainer1.SetDistanceOrDefault(Settings.SplitDistance, _defaultSplitDistance); - LuaImp.RegisteredFunctions.ChangedCallback = UpdateRegisteredFunctionsDialog; } private void BranchesMarkersSplit_SplitterMoved(object sender, SplitterEventArgs e) @@ -232,6 +229,8 @@ namespace BizHawk.Client.EmuHawk ? new UnixLuaLibraries() : new Win32LuaLibraries(Emulator.ServiceProvider, (MainForm) MainForm, DisplayManager, InputManager, Config, Emulator, Game); LuaImp.ScriptList.AddRange(currentScripts ?? Enumerable.Empty()); + LuaImp.ScriptList.ChangedCallback = SessionChangedCallback; + LuaImp.RegisteredFunctions.ChangedCallback = UpdateRegisteredFunctionsDialog; InputBox.AutoCompleteCustomSource.AddRange(LuaImp.Docs.Select(a => $"{a.Library}.{a.Name}").ToArray());