summaryrefslogtreecommitdiffstats
path: root/Action.c
diff options
context:
space:
mode:
authorDaniel Lange <DLange@git.local>2020-10-20 10:01:16 +0200
committerDaniel Lange <DLange@git.local>2020-10-20 10:01:16 +0200
commit475fd1ec2ddd88a7b0a3109a89ed6c587f7761b7 (patch)
tree2b39e87c8b24e48ef9bc6c84f850a844ba325ac0 /Action.c
parent2d57d289b13011a7d237c9486053ef83af978018 (diff)
parent898a6903758ab64d59412c638322395f918537e8 (diff)
Merge branch 'help_lines' of https://github.com/cgzones/htop
Diffstat (limited to 'Action.c')
-rw-r--r--Action.c59
1 files changed, 41 insertions, 18 deletions
diff --git a/Action.c b/Action.c
index b5bd5b54..7443c842 100644
--- a/Action.c
+++ b/Action.c
@@ -452,11 +452,14 @@ static Htop_Reaction actionHelp(State* st) {
for (int i = 0; i < LINES-1; i++)
mvhline(i, 0, ' ', COLS);
- mvaddstr(0, 0, "htop " VERSION " - " COPYRIGHT);
- mvaddstr(1, 0, "Released under the GNU GPLv2. See 'man' page for more info.");
+ int line = 0;
+
+ mvaddstr(line++, 0, "htop " VERSION " - " COPYRIGHT);
+ mvaddstr(line++, 0, "Released under the GNU GPLv2. See 'man' page for more info.");
attrset(CRT_colors[DEFAULT_COLOR]);
- mvaddstr(3, 0, "CPU usage bar: ");
+ line++;
+ mvaddstr(line++, 0, "CPU usage bar: ");
#define addattrstr(a,s) attrset(a);addstr(s)
addattrstr(CRT_colors[BAR_BORDER], "[");
if (settings->detailedCPUTime) {
@@ -478,7 +481,7 @@ static Htop_Reaction actionHelp(State* st) {
}
addattrstr(CRT_colors[BAR_BORDER], "]");
attrset(CRT_colors[DEFAULT_COLOR]);
- mvaddstr(4, 0, "Memory bar: ");
+ mvaddstr(line++, 0, "Memory bar: ");
addattrstr(CRT_colors[BAR_BORDER], "[");
addattrstr(CRT_colors[MEMORY_USED], "used"); addstr("/");
addattrstr(CRT_colors[MEMORY_BUFFERS_TEXT], "buffers"); addstr("/");
@@ -486,29 +489,49 @@ static Htop_Reaction actionHelp(State* st) {
addattrstr(CRT_colors[BAR_SHADOW], " used/total");
addattrstr(CRT_colors[BAR_BORDER], "]");
attrset(CRT_colors[DEFAULT_COLOR]);
- mvaddstr(5, 0, "Swap bar: ");
+ mvaddstr(line++, 0, "Swap bar: ");
addattrstr(CRT_colors[BAR_BORDER], "[");
addattrstr(CRT_colors[SWAP], "used");
addattrstr(CRT_colors[BAR_SHADOW], " used/total");
addattrstr(CRT_colors[BAR_BORDER], "]");
attrset(CRT_colors[DEFAULT_COLOR]);
- mvaddstr(6,0, "Type and layout of header meters are configurable in the setup screen.");
+ mvaddstr(line++,0, "Type and layout of header meters are configurable in the setup screen.");
if (CRT_colorScheme == COLORSCHEME_MONOCHROME) {
- mvaddstr(7, 0, "In monochrome, meters display as different chars, in order: |#*@$%&.");
+ mvaddstr(line, 0, "In monochrome, meters display as different chars, in order: |#*@$%&.");
}
- mvaddstr( 8, 0, " Status: R: running; S: sleeping; T: traced/stopped; Z: zombie; D: disk sleep");
- for (int i = 0; helpLeft[i].info; i++) { mvaddstr(9+i, 9, helpLeft[i].info); }
- for (int i = 0; helpRight[i].info; i++) { mvaddstr(9+i, 49, helpRight[i].info); }
- attrset(CRT_colors[HELP_BOLD]);
- for (int i = 0; helpLeft[i].key; i++) { mvaddstr(9+i, 0, helpLeft[i].key); }
- for (int i = 0; helpRight[i].key; i++) { mvaddstr(9+i, 40, helpRight[i].key); }
- attrset(CRT_colors[PROCESS_THREAD]);
- mvaddstr(17, 32, "threads");
- mvaddstr(18, 26, "threads");
- attrset(CRT_colors[DEFAULT_COLOR]);
+ line++;
+
+ mvaddstr(line++, 0, "Process state: R: running; S: sleeping; T: traced/stopped; Z: zombie; D: disk sleep");
+
+ line++;
+
+ int item;
+ for (item = 0; helpLeft[item].key; item++) {
+ attrset(CRT_colors[DEFAULT_COLOR]);
+ mvaddstr(line + item, 9, helpLeft[item].info);
+ attrset(CRT_colors[HELP_BOLD]);
+ mvaddstr(line + item, 0, helpLeft[item].key);
+ if (0 == strcmp(helpLeft[item].key, " H: ")) {
+ attrset(CRT_colors[PROCESS_THREAD]);
+ mvaddstr(line + item, 32, "threads");
+ } else if (0 == strcmp(helpLeft[item].key, " K: ")) {
+ attrset(CRT_colors[PROCESS_THREAD]);
+ mvaddstr(line + item, 26, "threads");
+ }
+ }
+ int leftHelpItems = item;
+
+ for (item = 0; helpRight[item].key; item++) {
+ attrset(CRT_colors[HELP_BOLD]);
+ mvaddstr(line + item, 40, helpRight[item].key);
+ attrset(CRT_colors[DEFAULT_COLOR]);
+ mvaddstr(line + item, 49, helpRight[item].info);
+ }
+ line += MAXIMUM(leftHelpItems, item);
+ line++;
attrset(CRT_colors[HELP_BOLD]);
- mvaddstr(24,0, "Press any key to return.");
+ mvaddstr(line++, 0, "Press any key to return.");
attrset(CRT_colors[DEFAULT_COLOR]);
refresh();
CRT_readKey();

© 2014-2024 Faster IT GmbH | imprint | privacy policy