@@ -43,6 +43,7 @@ pub struct App {
43
43
pub components : Vec < Box < dyn Component > > ,
44
44
pub quit_at : Option < std:: time:: Instant > ,
45
45
focus : Focus ,
46
+ run_mode : RunMode ,
46
47
previous_focus : Focus ,
47
48
done_callback : Option < ThreadsafeFunction < ( ) , ErrorStrategy :: Fatal > > ,
48
49
forced_shutdown_callback : Option < ThreadsafeFunction < ( ) , ErrorStrategy :: Fatal > > ,
@@ -111,6 +112,7 @@ impl App {
111
112
let main_terminal_pane_data = TerminalPaneData :: new ( ) ;
112
113
113
114
Ok ( Self {
115
+ run_mode,
114
116
components,
115
117
pinned_tasks,
116
118
quit_at : None ,
@@ -121,7 +123,7 @@ impl App {
121
123
tui_config,
122
124
user_has_interacted : false ,
123
125
is_forced_shutdown : false ,
124
- layout_manager : LayoutManager :: new ( task_count) ,
126
+ layout_manager : LayoutManager :: new_with_run_mode ( task_count, run_mode ) ,
125
127
frame_area : None ,
126
128
layout_areas : None ,
127
129
terminal_pane_data : [ main_terminal_pane_data, TerminalPaneData :: new ( ) ] ,
@@ -154,7 +156,11 @@ impl App {
154
156
. select_task ( task. clone ( ) ) ;
155
157
156
158
if pinned_tasks. len ( ) == 1 && idx == 0 {
157
- self . display_and_focus_current_task_in_terminal_pane ( self . tasks . len ( ) != 1 ) ;
159
+ self . display_and_focus_current_task_in_terminal_pane ( match self . run_mode {
160
+ RunMode :: RunMany => true ,
161
+ RunMode :: RunOne if self . tasks . len ( ) == 1 => false ,
162
+ RunMode :: RunOne => true ,
163
+ } ) ;
158
164
} else {
159
165
self . assign_current_task_to_pane ( idx) ;
160
166
}
@@ -179,7 +185,7 @@ impl App {
179
185
}
180
186
181
187
fn should_set_interactive_by_default ( & self , task_id : & str ) -> bool {
182
- self . tasks . len ( ) == 1
188
+ matches ! ( self . run_mode , RunMode :: RunOne )
183
189
&& self
184
190
. pty_instances
185
191
. get ( task_id)
0 commit comments