procps/0013-top-modest-efficiency-change-to-message-line-handlin.patch

98 lines
3.8 KiB
Diff
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

From 80e678343653ccadaaf66bf719b3da9d6168d9ec Mon Sep 17 00:00:00 2001
From: Jim Warner <james.warner@comcast.net>
Date: Thu, 15 Aug 2013 00:00:00 -0500
Subject: [PATCH] top: modest efficiency change to message line handling
When the final solution for cursor positioning for all
^Z or ^C cases was introduced the revised placement of
message line management introduced with the window mgr
'screen' refactor was retained. Those two commits mean
that a former tgoto was no longer needed when clearing
that msg line or displaying the scroll coordinate msg.
This patch eliminates the tgoto employed by frame_make
while assimilating a now defunct show_scroll function.
Reference(s):
. final cursor positioning for ^Z or ^C
commit 46a1356219cfab67240704af9cd73b58a20d4232
. 'screen' window manager refactor
commit 0fe393ff270922cd4f6edbcaabba006314e73a37
Signed-off-by: Jim Warner <james.warner@comcast.net>
---
top/top.c | 22 ++++++++++------------
top/top.h | 1 -
2 files changed, 10 insertions(+), 13 deletions(-)
diff --git top/top.c top/top.c
index e2451f5..c29bb07 100644
--- top/top.c
+++ top/top.c
@@ -751,13 +751,6 @@ static int show_pmt (const char *str) {
/*
- * Show a special coordinate message, in support of scrolling */
-static inline void show_scroll (void) {
- PUTT(Scroll_fmts, tg2(0, Msg_row), Frame_maxtask);
-} // end: show_scroll
-
-
- /*
* Show lines with specially formatted elements, but only output
* what will fit within the current screen width.
* Our special formatting consists of:
@@ -857,7 +850,7 @@ static void show_special (int interact, const char *glob) {
/*
* Create a nearly complete scroll coordinates message, but still
- * a format string since we'll be missing a tgoto and total tasks. */
+ * a format string since we'll be missing the current total tasks. */
static void updt_scroll_msg (void) {
char tmp1[SMLBUFSIZ], tmp2[SMLBUFSIZ];
int totpflgs = Curwin->totpflgs;
@@ -878,8 +871,10 @@ static void updt_scroll_msg (void) {
if (Curwin->varcolbeg)
snprintf(tmp2, sizeof(tmp2), "%s + %d", tmp1, Curwin->varcolbeg);
#endif
+ // this Scroll_fmts string no longer provides for termcap tgoto so that
+ // the usage timing is critical -- see frame_make() for additional info
snprintf(Scroll_fmts, sizeof(Scroll_fmts)
- , "%%s%s %.*s%s", Caps_off, Screen_cols - 3, tmp2, Cap_clr_eol);
+ , "%s %.*s%s", Caps_off, Screen_cols - 3, tmp2, Cap_clr_eol);
} // end: updt_scroll_msg
/*###### Low Level Memory/Keyboard/File I/O support ####################*/
@@ -5477,9 +5472,12 @@ static void frame_make (void) {
Max_lines = (Screen_rows - Msg_row) - 1;
OFFw(w, INFINDS_xxx);
- // one way or another, rid us of any prior frame's msg
- if (VIZISw(w) && CHKw(w, View_SCROLL)) show_scroll();
- else PUTT("%s%s", tg2(0, Msg_row), Cap_clr_eol);
+ /* one way or another, rid us of any prior frame's msg
+ [ now that this is positioned after the call to summary_show(), ]
+ [ we no longer need or employ tg2(0, Msg_row) since all summary ]
+ [ lines end with a newline, and header lines begin with newline ] */
+ if (VIZISw(w) && CHKw(w, View_SCROLL)) PUTT(Scroll_fmts, Frame_maxtask);
+ else putp(Cap_clr_eol);
if (!Rc.mode_altscr) {
// only 1 window to show so, piece o' cake
diff --git top/top.h top/top.h
index 43d1ebc..017644f 100644
--- top/top.h
+++ top/top.h
@@ -658,7 +658,6 @@ typedef struct WIN_t {
//atic void capsmk (WIN_t *q);
//atic void show_msg (const char *str);
//atic int show_pmt (const char *str);
-//atic inline void show_scroll (void);
//atic void show_special (int interact, const char *glob);
//atic void updt_scroll_msg (void);
/*------ Low Level Memory/Keyboard/File I/O support --------------------*/
--
1.7.9.2