top: circumvent an ncurses version 5.9.20121017 glitch

Some testing under a new distro revealed what appeared
to be a broken top Inspect request. When the selection
was made, the resulting output was scrambled/scrunched
at the bottom of the screen (as if ^J's were missing).

This anomaly surfaced under Fedora-18 which happens to
use the above ncurses version. The bug was not present
in version 5.9.20120714 (available with openSUSE 12.2)
or the more widely available version of: 5.9.20110404.

It has now been confirmed that this problem originated
in version 5.9.20120825. It was then that buffering of
output was changed from stdio to some internal ncurses
scheme so as to avoid problems with its SIGTSTP logic.

Thanks to a very prompt response from Thomas E. Dickey
we also learned that contrary to the documentation the
putp logic does not call putchar internally. Thus, the
single putchar that Inspect was employing was actually
mixing 2 different buffering schemes: ncurses & stdio.

Thus, from now on we'll use putp() exclusively and try
to achieve single char output as efficiently as we can
while meeting that putp() string argument requirement.

(everything is perfectly justified plus right margins)
(are completely filled, but of course it must be luck)

Reference(s):
https://bugzilla.redhat.com/892674

Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
Jim Warner 2013-01-07 00:00:00 -06:00 committed by Craig Small
parent d9f7c76114
commit 7060f9ab3a

View File

@ -2645,7 +2645,8 @@ static inline void insp_make_row (int col, int row) {
#define mkUNP { if ((to += 4) <= Screen_cols) \ #define mkUNP { if ((to += 4) <= Screen_cols) \
PUTT("%s<%02X>", (!hicap) ? Curwin->capclr_msg : "", uch); hicap = 1; } PUTT("%s<%02X>", (!hicap) ? Curwin->capclr_msg : "", uch); hicap = 1; }
#endif #endif
#define mkSTD { capNO; if (++to <= Screen_cols) putchar(uch); } #define mkSTD { capNO; if (++to <= Screen_cols) { static char _str[2]; \
_str[0] = uch; putp(_str); } }
char tline[SCREENMAX]; char tline[SCREENMAX];
int fr, to, ofs; int fr, to, ofs;
int hicap = 0; int hicap = 0;