diff options
author | Benny Baumann <BenBE@geshi.org> | 2022-05-19 22:03:12 +0200 |
---|---|---|
committer | Daniel Lange <DLange@git.local> | 2022-05-20 12:30:37 +0200 |
commit | 37e01cbe33714c8fde72220555b92c7d8585d127 (patch) | |
tree | 44f5fcce5adec215053f97d5cee3f9793e555ac0 | |
parent | d22667725a980e75a3c635567ec5c9400bcde02b (diff) |
Colorize process state characters in help screen
Thanks to @Low-power for the idea
Closes #1010
-rw-r--r-- | Action.c | 18 |
1 files changed, 16 insertions, 2 deletions
@@ -618,9 +618,23 @@ static Htop_Reaction actionHelp(State* st) { } line++; - mvaddstr(line++, 0, "Process state: R: running; S: sleeping; T: traced/stopped; Z: zombie; D: disk sleep"); +#define addattrstatestr(attr, state, desc) \ + do { \ + addattrstr(attr, state); \ + addattrstr(CRT_colors[DEFAULT_COLOR], ": " desc); \ + } while(0) + + mvaddstr(line, 0, "Process state: "); + addattrstatestr(CRT_colors[PROCESS_RUN_STATE], "R", "running; "); + addattrstatestr(CRT_colors[PROCESS_SHADOW], "S", "sleeping; "); + addattrstatestr(CRT_colors[PROCESS_RUN_STATE], "t", "traced/stopped; "); + addattrstatestr(CRT_colors[PROCESS_D_STATE], "Z", "zombie; "); + addattrstatestr(CRT_colors[PROCESS_D_STATE], "D", "dist sleep"); + attrset(CRT_colors[DEFAULT_COLOR]); - line++; +#undef addattrstatestr + + line += 2; const bool readonly = Settings_isReadonly(); |