summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Warner <james.warner@comcast.net>2021-10-04 00:00:00 -0500
committerCraig Small <csmall@dropbear.xyz>2021-10-08 18:30:44 +1100
commit67c150ed7c7c9908076ea47deceeed109b67122d (patch)
tree4d3feea1c360f1923617cbfa8ecee2c611be07b8
parenta5b51bc4174669d8074150a50cdac40979256f19 (diff)
downloadprocps-ng-67c150ed7c7c9908076ea47deceeed109b67122d.tar.gz
top: restore ending ']' when summary graphs are scaled
When a visual separator was added to 2 abreast summary items in a recent commit, this bug was introduced. So, from that earlier patch we'll revert one line of code. The bug surfaced under an 80/even column terminal only when that '4' toggle was off. With an an 81/odd column screen, it existed in both single and 2 abreast modes. [ this commit also goes the extra distance to ensure ] [ two abreast mode maximizes available screen width. ] Signed-off-by: Jim Warner <james.warner@comcast.net>
-rw-r--r--top/top.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/top/top.c b/top/top.c
index 2c92212..94a1ff8 100644
--- a/top/top.c
+++ b/top/top.c
@@ -192,7 +192,7 @@ static int Numa_node_sel = -1;
commands -- which are now both 4-way toggles */
#define GRAPH_prefix 25 // beginning text + opening '['
#define GRAPH_actual 100 // the actual bars or blocks
-#define GRAPH_suffix 1 // ending ']'
+#define GRAPH_suffix 2 // ending ']' + trailing space
static float Graph_adj; // bars/blocks scaling factor
static int Graph_len; // scaled length (<= GRAPH_actual)
static const char Graph_blks[] = " ";
@@ -1842,6 +1842,7 @@ static void adj_geometry (void) {
if (Screen_cols < DOUBLE_limit) Curwin->rc.double_up = 0;
if (Curwin->rc.double_up) {
Graph_len = (Screen_cols - DOUBLE_space - (2 * (GRAPH_prefix + GRAPH_suffix))) / 2;
+ Graph_len += (Screen_cols % 2) ? 0 : 1;
if (Graph_len > GRAPH_actual) Graph_len = GRAPH_actual;
}
Graph_adj = (float)Graph_len / 100.0;