@@ -571,46 +571,57 @@ static Htop_Reaction actionHelp(State* st) {
571
571
line ++ ;
572
572
mvaddstr (line ++ , 0 , "CPU usage bar: " );
573
573
574
+ #define addbartext (attr , prefix , text ) \
575
+ do { \
576
+ addattrstr(CRT_colors[DEFAULT_COLOR], prefix); \
577
+ addattrstr(attr, text); \
578
+ } while(0)
579
+
574
580
addattrstr (CRT_colors [BAR_BORDER ], "[" );
581
+ addbartext (CRT_colors [CPU_NICE_TEXT ], "" , "low" );
582
+ addbartext (CRT_colors [CPU_NORMAL ], "/" , "normal" );
583
+ addbartext (CRT_colors [CPU_SYSTEM ], "/" , "kernel" );
575
584
if (st -> settings -> detailedCPUTime ) {
576
- addattrstr (CRT_colors [CPU_NICE_TEXT ], "low" ); addstr ("/" );
577
- addattrstr (CRT_colors [CPU_NORMAL ], "normal" ); addstr ("/" );
578
- addattrstr (CRT_colors [CPU_SYSTEM ], "kernel" ); addstr ("/" );
579
- addattrstr (CRT_colors [CPU_IRQ ], "irq" ); addstr ("/" );
580
- addattrstr (CRT_colors [CPU_SOFTIRQ ], "soft-irq" ); addstr ("/" );
581
- addattrstr (CRT_colors [CPU_STEAL ], "steal" ); addstr ("/" );
582
- addattrstr (CRT_colors [CPU_GUEST ], "guest" ); addstr ("/" );
583
- addattrstr (CRT_colors [CPU_IOWAIT ], "io-wait" );
584
- addattrstr (CRT_colors [BAR_SHADOW ], " used%" );
585
+ addbartext (CRT_colors [CPU_IRQ ], "/" , "irq" );
586
+ addbartext (CRT_colors [CPU_SOFTIRQ ], "/" , "soft-irq" );
587
+ addbartext (CRT_colors [CPU_STEAL ], "/" , "steal" );
588
+ addbartext (CRT_colors [CPU_GUEST ], "/" , "guest" );
589
+ addbartext (CRT_colors [CPU_IOWAIT ], "/" , "io-wait" );
590
+ addbartext (CRT_colors [BAR_SHADOW ], " " , "used%" );
585
591
} else {
586
- addattrstr (CRT_colors [CPU_NICE_TEXT ], "low-priority" ); addstr ("/" );
587
- addattrstr (CRT_colors [CPU_NORMAL ], "normal" ); addstr ("/" );
588
- addattrstr (CRT_colors [CPU_SYSTEM ], "kernel" ); addstr ("/" );
589
- addattrstr (CRT_colors [CPU_GUEST ], "virtualized" );
590
- addattrstr (CRT_colors [BAR_SHADOW ], " used%" );
592
+ addbartext (CRT_colors [CPU_GUEST ], "/" , "guest" );
593
+ addbartext (CRT_colors [BAR_SHADOW ], " " , "used%" );
591
594
}
592
595
addattrstr (CRT_colors [BAR_BORDER ], "]" );
596
+
593
597
attrset (CRT_colors [DEFAULT_COLOR ]);
594
598
mvaddstr (line ++ , 0 , "Memory bar: " );
595
599
addattrstr (CRT_colors [BAR_BORDER ], "[" );
596
- addattrstr (CRT_colors [MEMORY_USED ], "used" ); addstr ("/" );
597
- addattrstr (CRT_colors [MEMORY_BUFFERS_TEXT ], "buffers" ); addstr ("/" );
598
- addattrstr (CRT_colors [MEMORY_SHARED ], "shared" ); addstr ("/" );
599
- addattrstr (CRT_colors [MEMORY_CACHE ], "cache" );
600
- addattrstr (CRT_colors [BAR_SHADOW ], " used/total" );
600
+ addbartext (CRT_colors [MEMORY_USED ], "" , "used" );
601
+ addbartext (CRT_colors [MEMORY_BUFFERS_TEXT ], "/" , "buffers" );
602
+ addbartext (CRT_colors [MEMORY_SHARED ], "/" , "shared" );
603
+ addbartext (CRT_colors [MEMORY_CACHE ], "/" , "cache" );
604
+ addbartext (CRT_colors [BAR_SHADOW ], " " , "used" );
605
+ addbartext (CRT_colors [BAR_SHADOW ], "/" , "totel" );
601
606
addattrstr (CRT_colors [BAR_BORDER ], "]" );
607
+
602
608
attrset (CRT_colors [DEFAULT_COLOR ]);
603
609
mvaddstr (line ++ , 0 , "Swap bar: " );
604
610
addattrstr (CRT_colors [BAR_BORDER ], "[" );
605
- addattrstr (CRT_colors [SWAP ], "used" );
611
+ addbartext (CRT_colors [SWAP ], "" , "used" );
606
612
#ifdef HTOP_LINUX
607
- addstr ("/" );
608
- addattrstr (CRT_colors [SWAP_CACHE ], "cache" );
609
- addattrstr (CRT_colors [BAR_SHADOW ], " used/total" );
613
+ addbartext (CRT_colors [SWAP_CACHE ], "/" , "cache" );
610
614
#else
611
- addattrstr (CRT_colors [BAR_SHADOW ], " used/total " );
615
+ addbartext (CRT_colors [SWAP_CACHE ], " " , " " );
612
616
#endif
617
+ addbartext (CRT_colors [BAR_SHADOW ], " " , "used" );
618
+ addbartext (CRT_colors [BAR_SHADOW ], "/" , "total" );
613
619
addattrstr (CRT_colors [BAR_BORDER ], "]" );
620
+
621
+ line ++ ;
622
+
623
+ #undef addbartext
624
+
614
625
attrset (CRT_colors [DEFAULT_COLOR ]);
615
626
mvaddstr (line ++ , 0 , "Type and layout of header meters are configurable in the setup screen." );
616
627
if (CRT_colorScheme == COLORSCHEME_MONOCHROME ) {
0 commit comments