Skip to content

Commit

Permalink
Open includes but switch back if not tracking line
Browse files Browse the repository at this point in the history
  • Loading branch information
DerelictDrone committed Aug 15, 2024
1 parent 4fc1c8a commit 1e9106e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lua/wire/cpulib.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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

Check warning on line 91 in lua/wire/cpulib.lua

View workflow job for this annotation

GitHub Actions / lint

"Whitespace style"

Style: Please put some whitespace before the operator

Check warning on line 91 in lua/wire/cpulib.lua

View workflow job for this annotation

GitHub Actions / lint

"Whitespace style"

Style: Please put some whitespace before the operator
Expand All @@ -94,6 +94,7 @@ if CLIENT or TESTING then
fullFileName = fileName
end

local currentTab = editor:GetActiveTabIndex()
local sourceTab
for tab=1,editor:GetNumTabs() do

Check warning on line 99 in lua/wire/cpulib.lua

View workflow job for this annotation

GitHub Actions / lint

"Whitespace style"

Style: Please put some whitespace before the operator
if editor:GetEditor(tab).chosenfile == fullFileName then
Expand All @@ -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
Expand Down

0 comments on commit 1e9106e

Please sign in to comment.