]> granicus.if.org Git - procps-ng/commitdiff
top: avoid premature forced loss of that bottom window
authorJim Warner <james.warner@comcast.net>
Mon, 13 Jun 2022 05:00:00 +0000 (00:00 -0500)
committerCraig Small <csmall@dropbear.xyz>
Tue, 14 Jun 2022 11:52:13 +0000 (21:52 +1000)
In the commit shown below the bottom window was forced
off if a full screen replacement function was invoked.
It did so by setting Frames_signal after calling those
routines from the keys_global function. However, there
was sometimes a possibility such action was premature.

At least two of those full screen replacement routines
may issue an error message & return without corrupting
the screen. As such, forcing off that bottom window is
totally unnecessary. It therefore should be preserved.

So this commit just moves the setting of Frames_signal
to the full screen replacement routines when possible.

Reference(s):
. May, 2022 - bottom window forced off for some
commit d66c1f39b52d53ec279fc638aa4a6352d7672201

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

index 3ec422f48a71fb64d296bfc3e11cd633581e51df..b725f68cae0ace85c707f094730b126d544df7ca 100644 (file)
--- a/top/top.c
+++ b/top/top.c
@@ -2435,6 +2435,9 @@ signify_that:
             break;
       }
    } while (key != 'q' && key != kbd_ESC);
+
+   // signal that we just corrupted entire screen
+   Frames_signal = BREAK_screen;
  #undef unSCRL
  #undef swapEM
  #undef spewFI
@@ -3362,6 +3365,8 @@ signify_that:
       }
    } while (key != 'q' && key != kbd_ESC);
 
+   // signal that we just corrupted entire screen
+   Frames_signal = BREAK_screen;
  #undef mkSEL
 } // end: inspection_utility
 
@@ -4567,7 +4572,8 @@ signify_that:
    } while (key != kbdAPPLY && key != kbdABORT);
 
    if (key == kbdABORT || key == kbd_ESC) wins_clrhlp(w, 0);
-
+   // signal that we just corrupted entire screen
+   Frames_signal = BREAK_screen;
  #undef kbdABORT
  #undef kbdAPPLY
 } // end: wins_colors
@@ -5275,6 +5281,8 @@ signify_that:
       default:
          goto signify_that;
    }
+   // signal that we just corrupted entire screen
+   Frames_signal = BREAK_screen;
 } // end: help_view
 
 
@@ -5413,8 +5421,6 @@ 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':
@@ -5439,8 +5445,6 @@ 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);
@@ -5523,18 +5527,12 @@ 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);
-                  // signal that we just corrupted entire screen
-                  Frames_signal = BREAK_screen;
-               }
+               if (pid) inspection_utility(pid);
             }
          }
          break;
       case 'Z':
          wins_colors();
-         // signal that we just corrupted entire screen
-         Frames_signal = BREAK_screen;
          mkVIZrow1
          break;
       case '0':