@@ -104,9 +104,28 @@ impl App {
104104 ) -> App {
105105 let palette = palette:: tailwind:: EMERALD ;
106106
107+ let mut events = vec ! [ ] ;
108+ let ( rpc_url, ws_url, datasource) = match & displayed_url {
109+ DisplayedUrl :: Datasource ( config) | DisplayedUrl :: Studio ( config) => (
110+ config. rpc_url . clone ( ) ,
111+ config. ws_url . clone ( ) ,
112+ config. rpc_datasource_url . clone ( ) ,
113+ ) ,
114+ } ;
115+ events. push ( (
116+ EventType :: Success ,
117+ Local :: now ( ) ,
118+ format ! ( "Surfnet up and running, emulating local Solana validator (RPC: {rpc_url}, WS: {ws_url})" ) ,
119+ ) ) ;
120+ events. push ( (
121+ EventType :: Info ,
122+ Local :: now ( ) ,
123+ format ! ( "Connecting surfnet to datasource {datasource}..." ) ,
124+ ) ) ;
125+
107126 App {
108- state : TableState :: default ( ) . with_selected ( 0 ) ,
109- scroll_state : ScrollbarState :: new ( 5 * ITEM_HEIGHT ) ,
127+ state : TableState :: default ( ) . with_offset ( 0 ) ,
128+ scroll_state : ScrollbarState :: new ( 0 ) ,
110129 colors : ColorTheme :: new ( & palette) ,
111130 simnet_events_rx,
112131 simnet_commands_tx,
@@ -120,27 +139,7 @@ impl App {
120139 transaction_count : None ,
121140 } ,
122141 successful_transactions : 0 ,
123- events : {
124- let mut events = vec ! [ ] ;
125- let ( rpc_url, ws_url, datasource) = match & displayed_url {
126- DisplayedUrl :: Datasource ( config) | DisplayedUrl :: Studio ( config) => (
127- config. rpc_url . clone ( ) ,
128- config. ws_url . clone ( ) ,
129- config. rpc_datasource_url . clone ( ) ,
130- ) ,
131- } ;
132- events. push ( (
133- EventType :: Success ,
134- Local :: now ( ) ,
135- format ! ( "Started local validator [RPC: {rpc_url}, WS: {ws_url}]" ) ,
136- ) ) ;
137- events. push ( (
138- EventType :: Success ,
139- Local :: now ( ) ,
140- format ! ( "Connected validator to datasource {datasource}" ) ,
141- ) ) ;
142- events
143- } ,
142+ events,
144143 include_debug_logs,
145144 deploy_progress_rx,
146145 status_bar_message : None ,
@@ -166,6 +165,10 @@ impl App {
166165 * self . state . offset_mut ( ) = ITEM_HEIGHT ;
167166 }
168167
168+ pub fn tail ( & mut self ) {
169+ self . state . select_last ( ) ;
170+ }
171+
169172 pub fn previous ( & mut self ) {
170173 self . state . select_previous ( ) ;
171174 self . scroll_state . prev ( ) ;
@@ -424,10 +427,10 @@ fn run_app<B: Backend>(terminal: &mut Terminal<B>, mut app: App) -> io::Result<(
424427
425428 for event in new_events {
426429 app. events . push ( event) ;
427- app. next ( ) ;
430+ app. tail ( ) ;
428431 }
429432
430- if event:: poll ( Duration :: from_millis ( 5 ) ) ? {
433+ if event:: poll ( Duration :: from_millis ( 25 ) ) ? {
431434 if let Event :: Key ( key_event) = event:: read ( ) ? {
432435 if key_event. kind == KeyEventKind :: Press {
433436 use KeyCode :: * ;
0 commit comments