Skip to content

Commit

Permalink
Colorize process state characters in help screen
Browse files Browse the repository at this point in the history
Thanks to @Low-power for the idea
Closes hishamhm#1010
  • Loading branch information
BenBE authored and Daniel Lange committed May 20, 2022
1 parent d226677 commit 37e01cb
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions Action.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down

0 comments on commit 37e01cb

Please sign in to comment.