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
This commit is contained in:
YoshiRulz 2021-03-25 15:30:43 +10:00
parent f7cacfab99
commit ddef661eb2
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
1 changed files with 2 additions and 3 deletions

View File

@ -166,8 +166,6 @@ namespace BizHawk.Client.EmuHawk
Settings = new LuaConsoleSettings(); Settings = new LuaConsoleSettings();
} }
LuaImp.ScriptList.ChangedCallback = SessionChangedCallback;
if (Config.RecentLuaSession.AutoLoad && !Config.RecentLuaSession.Empty) if (Config.RecentLuaSession.AutoLoad && !Config.RecentLuaSession.Empty)
{ {
LoadSessionFromRecent(Config.RecentLuaSession.MostRecent); LoadSessionFromRecent(Config.RecentLuaSession.MostRecent);
@ -196,7 +194,6 @@ namespace BizHawk.Client.EmuHawk
SetColumns(); SetColumns();
splitContainer1.SetDistanceOrDefault(Settings.SplitDistance, _defaultSplitDistance); splitContainer1.SetDistanceOrDefault(Settings.SplitDistance, _defaultSplitDistance);
LuaImp.RegisteredFunctions.ChangedCallback = UpdateRegisteredFunctionsDialog;
} }
private void BranchesMarkersSplit_SplitterMoved(object sender, SplitterEventArgs e) private void BranchesMarkersSplit_SplitterMoved(object sender, SplitterEventArgs e)
@ -232,6 +229,8 @@ namespace BizHawk.Client.EmuHawk
? new UnixLuaLibraries() ? new UnixLuaLibraries()
: new Win32LuaLibraries(Emulator.ServiceProvider, (MainForm) MainForm, DisplayManager, InputManager, Config, Emulator, Game); : new Win32LuaLibraries(Emulator.ServiceProvider, (MainForm) MainForm, DisplayManager, InputManager, Config, Emulator, Game);
LuaImp.ScriptList.AddRange(currentScripts ?? Enumerable.Empty<LuaFile>()); LuaImp.ScriptList.AddRange(currentScripts ?? Enumerable.Empty<LuaFile>());
LuaImp.ScriptList.ChangedCallback = SessionChangedCallback;
LuaImp.RegisteredFunctions.ChangedCallback = UpdateRegisteredFunctionsDialog;
InputBox.AutoCompleteCustomSource.AddRange(LuaImp.Docs.Select(a => $"{a.Library}.{a.Name}").ToArray()); InputBox.AutoCompleteCustomSource.AddRange(LuaImp.Docs.Select(a => $"{a.Library}.{a.Name}").ToArray());