summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJim Warner <james.warner@comcast.net>2022-09-18 00:00:00 -0500
committerCraig Small <csmall@dropbear.xyz>2022-09-20 18:50:55 +1000
commit124f26a423854614aae6bb9e4188e39cadb6b77c (patch)
treeb1b606a4f0cd72d88902534931a692d92b875334 /src
parent602146a623a28b12552831c01aff87c934a3451e (diff)
downloadprocps-ng-124f26a423854614aae6bb9e4188e39cadb6b77c.tar.gz
top: fix 'TOG4_MEM_1UP' if two abreast summary display
If one per line display of Mem/Swap data was forced by this #define, screen width was not fully exploited for graph mode. Rather, those graphs were scaled just like they would be if aligned with a nonexistent separator. With this commit, those graphs will expand to fill the screen width (or be limited by the maximum of '100' ). [ and in unrelated news a variable used in do_memory ] [ was changed for consistency. it doesn't affect the ] [ the results since a part1 of swap was always zero. ] Signed-off-by: Jim Warner <james.warner@comcast.net>
Diffstat (limited to 'src')
-rw-r--r--src/top/top.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/top/top.c b/src/top/top.c
index 9cd6a96..9fccc3e 100644
--- a/src/top/top.c
+++ b/src/top/top.c
@@ -2088,7 +2088,11 @@ static void adj_geometry (void) {
if (Graph_cpus->length > GRAPH_length_max) Graph_cpus->length = GRAPH_length_max;
if (Graph_cpus->length < GRAPH_length_min) Graph_cpus->length = GRAPH_length_min;
+#ifdef TOG4_MEM_1UP
+ Graph_mems->length = (Screen_cols - (GRAPH_prefix_std + GRAPH_suffix));
+#else
Graph_mems->length = (Screen_cols - ADJOIN_space - (2 * (pfx + GRAPH_suffix))) / 2;
+#endif
if (Graph_mems->length > GRAPH_length_max) Graph_mems->length = GRAPH_length_max;
if (Graph_mems->length < GRAPH_length_min) Graph_mems->length = GRAPH_length_min;
@@ -6520,7 +6524,7 @@ static void do_memory (void) {
#else
if (Curwin->rc.double_up > 1)
snprintf(row, sizeof(row), "%s %s~3%3.0f%s"
- , scT(label), N_txt(WORD_abv_swp_txt), rx->pcnt_tot, rx->graph);
+ , scT(label), N_txt(WORD_abv_swp_txt), rx->pcnt_two, rx->graph);
else {
prT(bfT(1), mkM(MEM_VAL(swp_TOT)));
snprintf(row, sizeof(row), "%s %s:~3%#5.1f~2/%-9.9s~3%s"