File tree Expand file tree Collapse file tree 3 files changed +10
-7
lines changed
Expand file tree Collapse file tree 3 files changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -56,6 +56,13 @@ impl App {
5656 )
5757 }
5858
59+ pub fn cycle_output_fmt ( & mut self ) {
60+ self . output_fmt = match self . output_fmt {
61+ OutputFmt :: Line => OutputFmt :: Bullet ,
62+ OutputFmt :: Bullet => OutputFmt :: Line ,
63+ } ;
64+ }
65+
5966 pub fn next_log_conn ( & mut self ) {
6067 if self . log_conn_idx != self . connections . lock ( ) . unwrap ( ) . len ( ) - 1 {
6168 self . log_conn_idx += 1 ;
Original file line number Diff line number Diff line change @@ -108,6 +108,7 @@ fn handle_events(app: &mut App) -> io::Result<()> {
108108 KeyCode :: Char ( 'q' | 'Q' ) => app. close ( ) ,
109109 KeyCode :: Char ( 'l' ) => app. next_tab ( ) ,
110110 KeyCode :: Char ( 'h' ) => app. prev_tab ( ) ,
111+ KeyCode :: Char ( 'o' ) if app. selected_tab == SelectedTab :: Live => app. cycle_output_fmt ( ) ,
111112 KeyCode :: Char ( 'j' ) if app. selected_tab == SelectedTab :: Log => {
112113 app. next_log_conn ( ) ;
113114 }
@@ -142,10 +143,5 @@ fn test_conn(conns: &Arc<Mutex<Vec<Connection>>>, idx: usize) {
142143 }
143144 } ;
144145
145- conns
146- . lock ( )
147- . unwrap ( )
148- . get_mut ( idx)
149- . unwrap ( )
150- . push_status ( code) ;
146+ conns. lock ( ) . unwrap ( ) . get_mut ( idx) . unwrap ( ) . push_status ( code) ;
151147}
Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ pub fn render_tab_live(f: &mut Frame, app: &App) {
3939 list_items. push ( conn_output) ;
4040 }
4141
42- let block = Block :: bordered ( ) . title_bottom ( " q: Quit " ) ;
42+ let block = Block :: bordered ( ) . title_bottom ( " q: Quit | o: Cycle formats " ) ;
4343
4444 f. render_widget (
4545 List :: new ( list_items) . block ( block) ,
You can’t perform that action at this time.
0 commit comments