1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-01-30 02:44:46 +00:00

Select the initial multishell tab when starting up

Before it was not actually selected until the task had yielded for the
first time. If a computer did not yield (or took a while to do so),
nothing would actually show up.
This commit is contained in:
SquidDev 2019-03-04 16:37:08 +00:00
parent 72d079ef61
commit e154e11186

View File

@ -48,7 +48,7 @@ local function resumeProcess( nProcess, sEvent, ... )
end end
end end
local function launchProcess( tProgramEnv, sProgramPath, ... ) local function launchProcess( bFocus, tProgramEnv, sProgramPath, ... )
local tProgramArgs = table.pack( ... ) local tProgramArgs = table.pack( ... )
local nProcess = #tProcesses + 1 local nProcess = #tProcesses + 1
local tProcess = {} local tProcess = {}
@ -70,6 +70,9 @@ local function launchProcess( tProgramEnv, sProgramPath, ... )
tProcess.terminal = tProcess.window tProcess.terminal = tProcess.window
tProcess.bInteracted = false tProcess.bInteracted = false
tProcesses[ nProcess ] = tProcess tProcesses[ nProcess ] = tProcess
if bFocus then
selectProcess( nProcess )
end
resumeProcess( nProcess ) resumeProcess( nProcess )
return nProcess return nProcess
end end
@ -241,7 +244,7 @@ function multishell.launch( tProgramEnv, sProgramPath, ... )
end end
local previousTerm = term.current() local previousTerm = term.current()
setMenuVisible( (#tProcesses + 1) >= 2 ) setMenuVisible( (#tProcesses + 1) >= 2 )
local nResult = launchProcess( tProgramEnv, sProgramPath, ... ) local nResult = launchProcess( false, tProgramEnv, sProgramPath, ... )
redrawMenu() redrawMenu()
term.redirect( previousTerm ) term.redirect( previousTerm )
return nResult return nResult
@ -254,11 +257,10 @@ end
-- Begin -- Begin
parentTerm.clear() parentTerm.clear()
setMenuVisible( false ) setMenuVisible( false )
selectProcess( launchProcess( { launchProcess( true, {
["shell"] = shell, ["shell"] = shell,
["multishell"] = multishell, ["multishell"] = multishell,
}, "/rom/programs/shell.lua" ) ) }, "/rom/programs/shell.lua" )
redrawMenu()
-- Run processes -- Run processes
while #tProcesses > 0 do while #tProcesses > 0 do