]> granicus.if.org Git - procps-ng/commitdiff
top: harden detailed stats two abreast summary display
authorJim Warner <james.warner@comcast.net>
Sun, 18 Sep 2022 05:00:00 +0000 (00:00 -0500)
committerCraig Small <csmall@dropbear.xyz>
Tue, 20 Sep 2022 08:50:55 +0000 (18:50 +1000)
When displaying detailed cpu statistics, as opposed to
those scalable graphs, only two per line can be shown.

Therefore, if we are showing a detail version, our '4'
toggle must prematurely revert to single mode display.

Conversely, the 't' toggle must also turn off that '4'
toggle rather than try to print more than 2 abreast if
we're currently executing in detailed statistics mode.

Signed-off-by: Jim Warner <james.warner@comcast.net>
src/top/top.c

index 7a1bc5ee8a57ce1b385473cefdf804a418fbb0c5..bf1fd0f6680128451879487e56a9e68e04a77823 100644 (file)
@@ -5727,6 +5727,9 @@ static void keys_summary (int ch) {
          if ((w->rc.double_up >= ADJOIN_limit)
          || ((w->rc.double_up >= Cpu_cnt)))
             w->rc.double_up = 0;
+         if ((w->rc.double_up > 1)
+         && (!w->rc.graph_cpus))
+            w->rc.double_up = 0;
          OFFw(w, (View_CPUSUM | View_CPUNOD));
          break;
       case 'C':
@@ -5750,6 +5753,9 @@ static void keys_summary (int ch) {
             w->rc.graph_cpus = 0;
             OFFw(w, View_STATES);
          }
+         if ((w->rc.double_up > 1)
+         && (!w->rc.graph_cpus))
+            w->rc.double_up = 0;
          break;
       default:                    // keep gcc happy
          break;