topten's so (standout) handling

This fixes the broken code that was using a boolean as an integer.
I didn't try to track down when it changed or what it looked like
before the change.  The intended effect is fairly straightforward;
just padding a bold line with spaces.  I've no idea why someone
deciced that that was useful though.

It also fixes something I broke six years ago:  tty_exit_nhwindows()
releases the termcap data needed for turning bold on and off, so
raw_print_bold() used by topten() stopped working on tty then.

Not fixed:  the code in really_done() for dealing with topten() vs
the 'toptenwin' option really ought to be redone.
This commit is contained in:
PatR
2022-01-31 18:20:34 -08:00
parent ae11c6e25d
commit 532cddbd35
3 changed files with 52 additions and 13 deletions

View File

@@ -891,8 +891,16 @@ topten(int how, time_t when)
free_ttlist(tt_head);
showwin:
if (iflags.toptenwin && !done_stopprint)
display_nhwindow(g.toptenwin, TRUE);
if (!done_stopprint) {
if (iflags.toptenwin) {
display_nhwindow(g.toptenwin, TRUE);
} else {
/* when not a window, we need something comparable to more()
but can't use it directly because we aren't dealing with
the message window */
;
}
}
destroywin:
if (!t0_used)
dealloc_ttentry(t0);
@@ -1042,11 +1050,11 @@ outentry(int rank, struct toptenentry* t1, boolean so)
Strcpy(linebuf3, bp);
else
Strcpy(linebuf3, bp + 1);
*bp = 0;
*bp = '\0';
if (so) {
while (bp < linebuf + (COLNO - 1))
*bp++ = ' ';
*bp = 0;
*bp = '\0';
topten_print_bold(linebuf);
} else
topten_print(linebuf);
@@ -1069,11 +1077,9 @@ outentry(int rank, struct toptenentry* t1, boolean so)
if (so) {
bp = eos(linebuf);
if (so >= COLNO)
so = COLNO - 1;
while (bp < linebuf + so)
while (bp < linebuf + (COLNO - 1))
*bp++ = ' ';
*bp = 0;
*bp = '\0';
topten_print_bold(linebuf);
} else
topten_print(linebuf);