]> granicus.if.org Git - procps-ng/commitdiff
top: reduce use of 'clear_screen' to absolute minimum
authorJim Warner <james.warner@comcast.net>
Tue, 7 Feb 2012 21:15:15 +0000 (15:15 -0600)
committerCraig Small <csmall@enc.com.au>
Wed, 8 Feb 2012 10:00:18 +0000 (21:00 +1100)
Along the way to width override support (-w switch),
this top began clearing the screen far more often
than his predecessor.  In fact, it happend with each
user keystroke.

This commit dramatically reduces those occurances.
The screen will now be cleared only when an actual
SIGWINCH is received.

Thanks for identifying this flaw belongs to:
James Cloos, cloos@jhcloos.com

References:
http://www.freelists.org/post/procps/Merge-request

Blame:   c2dcbef4826806f85b7ad6de2d9fe99bc390d603
Author:  Jim Warner <james.warner@comcast.net>
Date:    Thu May 26 11:33:32 2011 +0200
subject: added output width/height override support to top, + misc

top/top.c

index 45835052466498bf2f7b09bdeaa19b3e4ca784e2..2105076e787256bd965ec3cf4448e07e2f6e0357 100644 (file)
--- a/top/top.c
+++ b/top/top.c
@@ -568,7 +568,7 @@ static void sig_paused (int dont_care_sig) {
          *    SIGCONT and SIGWINCH */
 static void sig_resize (int dont_care_sig) {
    (void)dont_care_sig;
-   Frames_resize = 1;
+   Frames_resize = 2;
 } // end: sig_resize
 \f
 /*######  Misc Color/Display support  ####################################*/
@@ -1357,7 +1357,7 @@ static void adj_geometry (void) {
       Pseudo_screen = alloc_r(Pseudo_screen, pseudo_max);
    }
    PSU_CLREOS(0);
-   if (Frames_resize) putp(Cap_clr_scr);
+   if (Frames_resize > 1) putp(Cap_clr_scr);
 } // end: adj_geometry