@@ -172,6 +172,8 @@ int mtr_curses_keyaction(
172
172
return ActionReset ;
173
173
case 'd' :
174
174
return ActionDisplay ;
175
+ case 'c' :
176
+ return ActionCompact ;
175
177
case 'e' :
176
178
return ActionMPLS ;
177
179
case 'n' :
@@ -345,6 +347,7 @@ int mtr_curses_keyaction(
345
347
printw (" ?|h help\n" );
346
348
printw (" p pause (SPACE to resume)\n" );
347
349
printw (" d switching display mode\n" );
350
+ printw (" c switching compact mode\n" );
348
351
printw (" e toggle MPLS information on/off\n" );
349
352
printw (" n toggle DNS on/off\n" );
350
353
printw (" r reset all counters\n" );
@@ -689,7 +692,7 @@ void mtr_curses_redraw(
689
692
erase ();
690
693
getmaxyx (stdscr , __unused_int , maxx );
691
694
692
- rowstat = 5 ;
695
+ rowstat = ! ctl -> CompactLayout ;
693
696
694
697
move (0 , 0 );
695
698
attron (A_BOLD );
@@ -698,34 +701,38 @@ void mtr_curses_redraw(
698
701
pwcenter (buf );
699
702
attroff (A_BOLD );
700
703
701
- mvprintw (1 , 0 , "%s (%s) -> %s (%s)" ,
704
+ mvprintw (rowstat , 0 , "%s (%s) -> %s (%s)" ,
702
705
ctl -> LocalHostname , net_localaddr (),
703
706
ctl -> Hostname , net_remoteaddr ());
704
707
t = time (NULL );
705
- mvprintw (1 , maxx - 25 , "%s" , iso_time (& t ));
706
- printw ("\n" );
708
+ mvprintw (rowstat , maxx - 25 , "%s" , iso_time (& t ));
709
+ if (rowstat ) {
710
+ printw ("\n" );
707
711
708
- printw ("Keys: " );
709
- attron (A_BOLD );
710
- printw ("H" );
711
- attroff (A_BOLD );
712
- printw ("elp " );
713
- attron (A_BOLD );
714
- printw ("D" );
715
- attroff (A_BOLD );
716
- printw ("isplay mode " );
717
- attron (A_BOLD );
718
- printw ("R" );
719
- attroff (A_BOLD );
720
- printw ("estart statistics " );
721
- attron (A_BOLD );
722
- printw ("O" );
723
- attroff (A_BOLD );
724
- printw ("rder of fields " );
725
- attron (A_BOLD );
726
- printw ("q" );
727
- attroff (A_BOLD );
728
- printw ("uit\n" );
712
+ printw ("Keys: " );
713
+ attron (A_BOLD );
714
+ printw ("H" );
715
+ attroff (A_BOLD );
716
+ printw ("elp " );
717
+ attron (A_BOLD );
718
+ printw ("D" );
719
+ attroff (A_BOLD );
720
+ printw ("isplay mode " );
721
+ attron (A_BOLD );
722
+ printw ("R" );
723
+ attroff (A_BOLD );
724
+ printw ("estart statistics " );
725
+ attron (A_BOLD );
726
+ printw ("O" );
727
+ attroff (A_BOLD );
728
+ printw ("rder of fields " );
729
+ attron (A_BOLD );
730
+ printw ("q" );
731
+ attroff (A_BOLD );
732
+ printw ("uit\n" );
733
+ }
734
+
735
+ rowstat = rowstat ? 5 : 1 ;
729
736
730
737
if (ctl -> display_mode == DisplayModeDefault ) {
731
738
for (i = 0 ; i < MAXFLD ; i ++ ) {
@@ -761,8 +768,10 @@ void mtr_curses_redraw(
761
768
maxx <= SAVED_PINGS + padding ? maxx - padding : SAVED_PINGS ;
762
769
startstat = padding - 2 ;
763
770
764
- snprintf (msg , sizeof (msg ), " Last %3d pings" , max_cols );
765
- mvprintw (rowstat - 1 , startstat , "%s" , msg );
771
+ if (rowstat > 1 ) {
772
+ snprintf (msg , sizeof (msg ), " Last %3d pings" , max_cols );
773
+ mvprintw (rowstat - 1 , startstat , "%s" , msg );
774
+ }
766
775
767
776
attroff (A_BOLD );
768
777
move (rowstat , 0 );
0 commit comments