@@ -47,6 +47,12 @@ enum TuiTerminalSessionStateSource {
4747 orchestration_tabs_available : Rc < dyn Fn ( & AppContext ) -> bool > ,
4848 } ,
4949}
50+ #[ derive( Clone , Copy , Debug , Eq , PartialEq ) ]
51+ pub ( super ) enum TuiFirstZeroStateState {
52+ Pending ,
53+ Visible ,
54+ Dismissed ,
55+ }
5056
5157/// Persistent session-owned model that resolves a live state snapshot.
5258///
@@ -56,7 +62,7 @@ enum TuiTerminalSessionStateSource {
5662/// presentation components one shared state source.
5763pub ( crate ) struct TuiTerminalSessionStateModel {
5864 source : TuiTerminalSessionStateSource ,
59- show_first_zero_state : bool ,
65+ first_zero_state : TuiFirstZeroStateState ,
6066}
6167
6268#[ derive( Clone , Copy , Debug , Eq , PartialEq ) ]
@@ -97,14 +103,14 @@ impl Entity for TuiTerminalSessionStateModel {
97103}
98104
99105impl TuiTerminalSessionStateModel {
100- pub ( crate ) fn new (
106+ pub ( super ) fn new (
101107 terminal_model : & Arc < FairMutex < TerminalModel > > ,
102108 cli_subagent_controller : & ModelHandle < CLISubagentController > ,
103109 transcript : & ViewHandle < TuiTranscriptView > ,
104110 input_mode : & ModelHandle < BlocklistAIInputModel > ,
105111 suggestions_mode : & ModelHandle < TuiInputSuggestionsModeModel > ,
106112 orchestration_tab_bar : & ViewHandle < TuiTabBarView > ,
107- show_first_zero_state : bool ,
113+ first_zero_state : TuiFirstZeroStateState ,
108114 ) -> Self {
109115 Self {
110116 source : TuiTerminalSessionStateSource :: Session {
@@ -115,17 +121,36 @@ impl TuiTerminalSessionStateModel {
115121 suggestions_mode : suggestions_mode. downgrade ( ) ,
116122 orchestration_tab_bar : orchestration_tab_bar. downgrade ( ) ,
117123 } ,
118- show_first_zero_state ,
124+ first_zero_state ,
119125 }
120126 }
121127
122128 pub ( crate ) fn show_first_zero_state ( & self ) -> bool {
123- self . show_first_zero_state
129+ self . first_zero_state == TuiFirstZeroStateState :: Visible
130+ }
131+
132+ pub ( crate ) fn set_first_zero_state_pending ( & mut self , ctx : & mut ModelContext < Self > ) {
133+ if self . first_zero_state != TuiFirstZeroStateState :: Pending {
134+ self . first_zero_state = TuiFirstZeroStateState :: Pending ;
135+ ctx. notify ( ) ;
136+ }
137+ }
138+
139+ pub ( crate ) fn resolve_first_zero_state ( & mut self , show : bool , ctx : & mut ModelContext < Self > ) {
140+ if self . first_zero_state != TuiFirstZeroStateState :: Pending {
141+ return ;
142+ }
143+ self . first_zero_state = if show {
144+ TuiFirstZeroStateState :: Visible
145+ } else {
146+ TuiFirstZeroStateState :: Dismissed
147+ } ;
148+ ctx. notify ( ) ;
124149 }
125150
126- pub ( crate ) fn set_show_first_zero_state ( & mut self , show : bool , ctx : & mut ModelContext < Self > ) {
127- if self . show_first_zero_state != show {
128- self . show_first_zero_state = show ;
151+ pub ( crate ) fn dismiss_first_zero_state ( & mut self , ctx : & mut ModelContext < Self > ) {
152+ if self . first_zero_state != TuiFirstZeroStateState :: Dismissed {
153+ self . first_zero_state = TuiFirstZeroStateState :: Dismissed ;
129154 ctx. notify ( ) ;
130155 }
131156 }
@@ -141,7 +166,7 @@ impl TuiTerminalSessionStateModel {
141166 suggestions_mode : suggestions_mode. downgrade ( ) ,
142167 orchestration_tabs_available : Rc :: new ( orchestration_tabs_available) ,
143168 } ,
144- show_first_zero_state : false ,
169+ first_zero_state : TuiFirstZeroStateState :: Dismissed ,
145170 }
146171 }
147172
0 commit comments