Package: procps
Version: 1:3.2.7-11
Severity: normal
Tags: patch

When I press 1 to toggle Single/Seperate Cpu States, top lets me switch to the 
latter mode, even if the terminal is too small to display NUM_CPUS+7 lines. 
Trying to switch back yields a 
" Sorry, terminal is not big enough" message. So i get "trapped" in Seperate 
CPU display mode.

Example:
32 Core-machine, xterm with 38 lines. When I press 1 Cpu1 -32 are displayed, 
when 1 press 1 again it gives me the "terminal not big enough message". I 
attached a patch to avoid this condition by disabling the switch to Seperate 
CPU Stae view if the display is too small ( < NUM_CPUS+7, as defined somewhere 
in the code). Now if one tries to toggle views, top displays "Sorry, terminal 
is not big enough" if the terminal is too small, but still allows toggling back 
to "normal" even if the terminal is minimized even more. 

Regards,  Simon

-- System Information:
Debian Release: 5.0.3
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.26-2-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages procps depends on:
ii  libc6                     2.7-18         GNU C Library: Shared libraries
ii  libncurses5               5.7+20081213-1 shared libraries for terminal hand
ii  lsb-base                  3.2-20         Linux Standard Base 3.2 init scrip

Versions of packages procps recommends:
ii  psmisc                        22.6-1     Utilities that use the proc filesy

procps suggests no packages.

-- no debconf information
--- top.c.orig  2009-11-10 13:22:11.000000000 +0100
+++ top.c       2009-11-10 13:25:12.000000000 +0100
@@ -2484,10 +2484,16 @@
 #endif
 
    switch (c) {
       case '1':
-         if (Cpu_tot+7 > Screen_rows && !CHKw(Curwin, View_CPUSUM)) {
-            show_msg(err_num_cpus);
+         if (Cpu_tot+7 > Screen_rows ) {
+             if (!CHKw(Curwin, View_CPUSUM)) {
+                 TOGw(Curwin,View_CPUSUM);
+                 break;
+                } else {
+                       show_msg(err_num_cpus);
+                       break;
+                       }
             break;
          }
 #ifdef WARN_NOT_SMP
          if (Cpu_tot > 1) TOGw(Curwin, View_CPUSUM);

Reply via email to