top: give inspect display page algorithm a small boost

This commit improves display performance when the user
has scrolled horizontally past the end of a top 'row'.

We can avoid the need to memset our buffer with spaces
and putp those spaces individually by exploiting logic
that already exists. If one '\n' character is inserted
into the buffer instead, the next terminfo string sent
will be Cap_clr_eol achieving exactly the same effect!

(now that we know a '.' + 2 spaces is squeezed to one)
(everything's perfectly justified, but it's just luck)

Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
Jim Warner 2012-11-28 00:00:00 -06:00 committed by Craig Small
parent d2c84c6e13
commit 2db582e31e

View File

@ -2514,7 +2514,7 @@ static void insp_find (int ch, int *col, int *row) {
/*
* This guy is an insp_view_this() *Helper* function responsible
* for positioning us in both the x/y axes within the former glob
* for positioning us in both the x/y axes within the current glob
* and displaying a page worth of damages. Along the way, he makes
* sure that any control characters and/or unprintable characters
* use a less-like approach which distinguishes between two forms
@ -2550,10 +2550,11 @@ static inline void insp_show_pg (int col, int row, int max) {
capNO;
putp("\n");
memset(tline, ' ', sizeof(tline));
len = INSP_RLEN(row);
if (col < len)
memcpy(tline, Insp_p[row] + col, sizeof(tline));
else tline[0] = '\n';
for (fr = 0, to = 0; fr < len && to < Screen_cols; fr++) {
unsigned char uch = tline[fr];
if (uch == '\n') break; // a no show (he,he)