From 1e9106e8d8218937ad033e98ef31dddf843f4f95 Mon Sep 17 00:00:00 2001 From: DerelictDrone Date: Wed, 14 Aug 2024 19:14:50 -0500 Subject: [PATCH] Open includes but switch back if not tracking line --- lua/wire/cpulib.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lua/wire/cpulib.lua b/lua/wire/cpulib.lua index 15e7482..5665638 100644 --- a/lua/wire/cpulib.lua +++ b/lua/wire/cpulib.lua @@ -85,7 +85,7 @@ if CLIENT or TESTING then ------------------------------------------------------------------------------ -- Make sure the file is opened in the tab - function CPULib.SelectTab(editor,fileName,dontSetActive) + function CPULib.SelectTab(editor,fileName,dontForceChange) if not editor then return end local editorType = string.lower(editor.EditorType) local fullFileName = editorType.."chip\\"..fileName @@ -94,6 +94,7 @@ if CLIENT or TESTING then fullFileName = fileName end + local currentTab = editor:GetActiveTabIndex() local sourceTab for tab=1,editor:GetNumTabs() do if editor:GetEditor(tab).chosenfile == fullFileName then @@ -104,8 +105,11 @@ if CLIENT or TESTING then if not sourceTab then editor:LoadFile(fullFileName,true) sourceTab = editor:GetActiveTabIndex() + if dontForceChange then + editor:SetActiveTab(currentTab) + end else - if not dontSetActive then + if not dontForceChange then editor:SetActiveTab(sourceTab) end end