diff options
author | Jim Warner <james.warner@comcast.net> | 2023-01-11 00:00:00 -0600 |
---|---|---|
committer | Craig Small <csmall@dropbear.xyz> | 2023-01-15 15:02:39 +1100 |
commit | 28f44729dab9b292a9d5499f8cad6a12c1eb4ae5 (patch) | |
tree | be06a460257737b0ff986cbdcbb95047111ec65c | |
parent | 548c6a05baaf514d04d2c7000751c6a5e27a1182 (diff) | |
download | procps-ng-28f44729dab9b292a9d5499f8cad6a12c1eb4ae5.tar.gz |
top: lessen overhead when 'bottom window' isn't active
In the commits referenced below special code was added
to make the bottom window sticky and fix the bug after
'Cap_nl_clreos' was traded for the 'Cap_clr_eol' loop.
However, there's always major overhead associated with
interacting with a terminal. So we'll only abandon the
single 'Cap_nl_clreos' putp in favor of repeated calls
with 'Cap_clr_eol' when a bottom window isn't present.
Reference(s):
. May, 2022 - bottom window batch bug fix
commit 793f3e85aeb41788e359c2f6f387812c328ac097
. May, 2022 - bottom window made sticky
commit 0f2a755b0b2754fca79545984e25ec52f4ae4444
Signed-off-by: Jim Warner <james.warner@comcast.net>
-rw-r--r-- | src/top/top.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/top/top.c b/src/top/top.c index 390e92a..6cade5e 100644 --- a/src/top/top.c +++ b/src/top/top.c @@ -105,6 +105,7 @@ static int Screen_cols, Screen_rows, Max_lines; /* These 'SCREEN_ROWS', 'BOT_ and 'Bot_' guys are used in managing the special separate bottom 'window' ... */ #define SCREEN_ROWS ( Screen_rows - Bot_rsvd ) +#define BOT_PRESENT ( Bot_what > 0 ) #define BOT_ITEMMAX 10 // Bot_item array's max size #define BOT_MSGSMAX 10 // total entries for Msg_tab #define BOT_UNFOCUS -1 // tab focus not established @@ -5669,7 +5670,7 @@ static void keys_global (int ch) { bot_item_toggle(EU_CGR, N_fmt(X_BOT_ctlgrp_fmt), BOT_SEP_SLS); break; case kbd_CtrlI: - if (Bot_what) { + if (BOT_PRESENT) { ++Bot_indx; if (Bot_indx > Bot_focus_func(NULL, NULL)) Bot_indx = BOT_UNFOCUS; @@ -5719,7 +5720,7 @@ static void keys_global (int ch) { bot_item_toggle(EU_SGN, N_fmt(X_BOT_supgrp_fmt), BOT_SEP_CMA); break; case kbd_BTAB: - if (Bot_what) { + if (BOT_PRESENT) { --Bot_indx; num = Bot_focus_func(NULL, NULL); if (Bot_indx <= BOT_UNFOCUS) @@ -7317,9 +7318,13 @@ static void frame_make (void) { /* clear to end-of-screen - critical if last window is 'idleps off' (main loop must iterate such that we're always called before sleep) */ if (!Batch && scrlins < Max_lines) { - for (i = scrlins + Msg_row + 1; i < SCREEN_ROWS; i++) { - putp(tg2(0, i)); - putp(Cap_clr_eol); + if (!BOT_PRESENT) + putp(Cap_nl_clreos); + else { + for (i = scrlins + Msg_row + 1; i < SCREEN_ROWS; i++) { + putp(tg2(0, i)); + putp(Cap_clr_eol); + } } PSU_CLREOS(Pseudo_row); } |