From e154e1118665da27d2af42095fe14c7e6f7df0ce Mon Sep 17 00:00:00 2001 From: SquidDev Date: Mon, 4 Mar 2019 16:37:08 +0000 Subject: [PATCH] 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. --- .../lua/rom/programs/advanced/multishell.lua | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main/resources/assets/computercraft/lua/rom/programs/advanced/multishell.lua b/src/main/resources/assets/computercraft/lua/rom/programs/advanced/multishell.lua index 079d87eb3..d30c2c3ff 100644 --- a/src/main/resources/assets/computercraft/lua/rom/programs/advanced/multishell.lua +++ b/src/main/resources/assets/computercraft/lua/rom/programs/advanced/multishell.lua @@ -48,7 +48,7 @@ local function resumeProcess( nProcess, sEvent, ... ) end end -local function launchProcess( tProgramEnv, sProgramPath, ... ) +local function launchProcess( bFocus, tProgramEnv, sProgramPath, ... ) local tProgramArgs = table.pack( ... ) local nProcess = #tProcesses + 1 local tProcess = {} @@ -70,6 +70,9 @@ local function launchProcess( tProgramEnv, sProgramPath, ... ) tProcess.terminal = tProcess.window tProcess.bInteracted = false tProcesses[ nProcess ] = tProcess + if bFocus then + selectProcess( nProcess ) + end resumeProcess( nProcess ) return nProcess end @@ -241,7 +244,7 @@ function multishell.launch( tProgramEnv, sProgramPath, ... ) end local previousTerm = term.current() setMenuVisible( (#tProcesses + 1) >= 2 ) - local nResult = launchProcess( tProgramEnv, sProgramPath, ... ) + local nResult = launchProcess( false, tProgramEnv, sProgramPath, ... ) redrawMenu() term.redirect( previousTerm ) return nResult @@ -254,11 +257,10 @@ end -- Begin parentTerm.clear() setMenuVisible( false ) -selectProcess( launchProcess( { +launchProcess( true, { ["shell"] = shell, ["multishell"] = multishell, -}, "/rom/programs/shell.lua" ) ) -redrawMenu() +}, "/rom/programs/shell.lua" ) -- Run processes while #tProcesses > 0 do