From e5386f1f217989c9e62188111891cb43ec11a244 Mon Sep 17 00:00:00 2001 From: Jim Warner Date: Sun, 18 Sep 2022 00:00:00 -0500 Subject: [PATCH] top: harden detailed stats two abreast summary display 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 --- src/top/top.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/top/top.c b/src/top/top.c index 7a1bc5ee..bf1fd0f6 100644 --- a/src/top/top.c +++ b/src/top/top.c @@ -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;