top: tweak scroll coordinates msg handling (again)

An earlier commit improved the scroll coordinates
message performance by offloading most of the work
to those occasions when column headers were rebuilt.

The only remaining per-frame costs were the addition
of some terminfo escapes and the Frame_maxtask count.

This commit further reduces those per-frame costs to
the absolute minimum.

Reference:
commit fbfaa868babb0974c799d45e208619412afbdfef

Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
Jim Warner 2012-10-22 22:22:22 -05:00 committed by Craig Small
parent 0163abb48b
commit 99010db097

View File

@ -695,10 +695,7 @@ static int show_pmt (const char *str) {
/* /*
* Show a special coordinate message, in support of scrolling */ * Show a special coordinate message, in support of scrolling */
static inline void show_scroll (void) { static inline void show_scroll (void) {
char tmp[SMLBUFSIZ]; PUTT(Scroll_fmts, tg2(0, Msg_row), Frame_maxtask);
snprintf(tmp, sizeof(tmp), Scroll_fmts, Frame_maxtask);
PUTT("%s%s %.*s%s", tg2(0, Msg_row), Caps_off, Screen_cols - 2, tmp, Cap_clr_eol);
putp(tg2(0, Msg_row)); putp(tg2(0, Msg_row));
} // end: show_scroll } // end: show_scroll
@ -795,11 +792,9 @@ static void show_special (int interact, const char *glob) {
/* /*
* Create a nearly complete scroll coordinates message, but still * Create a nearly complete scroll coordinates message, but still
* technically a format string since we're missing total tasks. */ * a format string since we'll be missing a tgoto and total tasks. */
static void updt_scroll_msg (void) { static void updt_scroll_msg (void) {
#ifndef SCROLLVAR_NO char tmp1[SMLBUFSIZ], tmp2[SMLBUFSIZ];
char tmp[SMLBUFSIZ];
#endif
int totpflgs = Curwin->totpflgs; int totpflgs = Curwin->totpflgs;
int begpflgs = Curwin->begpflg + 1; int begpflgs = Curwin->begpflg + 1;
@ -811,14 +806,15 @@ static void updt_scroll_msg (void) {
#endif #endif
if (1 > totpflgs) totpflgs = 1; if (1 > totpflgs) totpflgs = 1;
if (1 > begpflgs) begpflgs = 1; if (1 > begpflgs) begpflgs = 1;
snprintf(Scroll_fmts, sizeof(Scroll_fmts) snprintf(tmp1, sizeof(tmp1)
, N_fmt(SCROLL_coord_fmt) , N_fmt(SCROLL_coord_fmt), Curwin->begtask + 1, begpflgs, totpflgs);
, Curwin->begtask + 1 strcpy(tmp2, tmp1);
, begpflgs, totpflgs);
#ifndef SCROLLVAR_NO #ifndef SCROLLVAR_NO
snprintf(tmp, sizeof(tmp), Curwin->varcolbeg ? " + %d" : "", Curwin->varcolbeg); if (Curwin->varcolbeg)
scat (Scroll_fmts, tmp); snprintf(tmp2, sizeof(tmp2), "%s + %d", tmp1, Curwin->varcolbeg);
#endif #endif
snprintf(Scroll_fmts, sizeof(Scroll_fmts)
, "%%s%s %.*s%s", Caps_off, Screen_cols - 3, tmp2, Cap_clr_eol);
} // end: updt_scroll_msg } // end: updt_scroll_msg
/*###### Low Level Memory/Keyboard support #############################*/ /*###### Low Level Memory/Keyboard support #############################*/