]> granicus.if.org Git - procps-ng/commitdiff
top: turn off the 'Ctrl' bottom window after some keys <=== port of newlib d66c1f39
authorJim Warner <james.warner@comcast.net>
Wed, 15 Jun 2022 05:00:00 +0000 (00:00 -0500)
committerCraig Small <csmall@dropbear.xyz>
Sun, 19 Jun 2022 10:58:51 +0000 (20:58 +1000)
______________________________ original newlib message

To complete the implementation of this new feature, we
must address the problem created by any commands which
offer their own full replacement displays. Should that
'Ctrl' bottom window be active, a return from any such
command leaves that lower portion of a terminal blank.

While we could issue a 'TAGGED_TOSS' macro right after
invoking any of those 4 (currently) affected commands,
it is wrong to make them aware of this 'tagged' stuff.

So, I'll opt for a more generalized solution whereby a
notice regarding a corrupted screen is broadcast. Then
the logic already aware of 'tagging' can deal with it.

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

index d6125004de5b64b39429c27c2c080fa16a196c29..20536a691ab2d1f6b44a48a2010c6fae6a4424b6 100644 (file)
--- a/top/top.c
+++ b/top/top.c
@@ -5391,6 +5391,8 @@ static void keys_global (int ch) {
       case '?':
       case 'h':
          help_view();
+         // signal that we just corrupted entire screen
+         Frames_signal = BREAK_screen;
          mkVIZrow1
          break;
       case 'B':
@@ -5415,6 +5417,8 @@ static void keys_global (int ch) {
          break;
       case 'f':
          fields_utility();
+         // signal that we just corrupted entire screen
+         Frames_signal = BREAK_screen;
          break;
       case 'g':
          win_select(0);
@@ -5492,12 +5496,18 @@ static void keys_global (int ch) {
             pid = get_int(fmtmk(N_fmt(YINSP_pidsee_fmt), def));
             if (pid > GET_NUM_ESC) {
                if (pid == GET_NUM_NOT) pid = def;
-               if (pid) inspection_utility(pid);
+               if (pid) {
+                  inspection_utility(pid);
+                  // signal that we just corrupted entire screen
+                  Frames_signal = BREAK_screen;
+               }
             }
          }
          break;
       case 'Z':
          wins_colors();
+         // signal that we just corrupted entire screen
+         Frames_signal = BREAK_screen;
          mkVIZrow1
          break;
       case '0':
@@ -6387,6 +6397,7 @@ static void do_key (int ch) {
    };
    int i;
 
+   Frames_signal = BREAK_off;
    switch (ch) {
       case 0:                // ignored (always)
       case kbd_ESC:          // ignored (sometimes)
@@ -6402,7 +6413,8 @@ static void do_key (int ch) {
          for (i = 0; i < MAXTBL(key_tab); ++i)
             if (strchr(key_tab[i].keys, ch)) {
                key_tab[i].func(ch);
-               Frames_signal = BREAK_kbd;
+               if (Frames_signal == BREAK_off)
+                  Frames_signal = BREAK_kbd;
                goto all_done;
             }
    };
@@ -6939,7 +6951,9 @@ static void frame_make (void) {
 
    // deal with potential signal(s) since the last time around...
    if (Frames_signal) {
-      if (Frames_signal == BREAK_sig) TAGGED_TOSS;
+      if (Frames_signal == BREAK_sig
+      || (Frames_signal == BREAK_screen))
+         TAGGED_TOSS;
       zap_fieldstab();
    }
 
index a7a1caa84b31d5c8248096f77272ff24f2d0f14d..1d8632bbd4526609fb970ce6afffe5f48fc9b980 100644 (file)
--- a/top/top.h
+++ b/top/top.h
@@ -242,7 +242,7 @@ enum scale_enum {
 
         /* Used to manipulate (and document) the Frames_signal states */
 enum resize_states {
-   BREAK_off = 0, BREAK_kbd, BREAK_sig, BREAK_autox
+   BREAK_off = 0, BREAK_kbd, BREAK_sig, BREAK_autox, BREAK_screen
 };
 
         /* This typedef just ensures consistent 'process flags' handling */