Fix for PR lib/47397

Fix a misinterpretation of the role of field fore and back.  Now field
pad is rendered in the back attribute always instead of only being used
for the non-current field.
This commit is contained in:
blymn 2021-10-19 21:22:20 +00:00
parent 022f9c1147
commit 5b90c1a33c
1 changed files with 11 additions and 12 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: internals.c,v 1.40 2021/04/13 13:13:04 christos Exp $ */
/* $NetBSD: internals.c,v 1.41 2021/10/19 21:22:20 blymn Exp $ */
/*-
* Copyright (c) 1998-1999 Brett Lymn
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__RCSID("$NetBSD: internals.c,v 1.40 2021/04/13 13:13:04 christos Exp $");
__RCSID("$NetBSD: internals.c,v 1.41 2021/10/19 21:22:20 blymn Exp $");
#include <limits.h>
#include <ctype.h>
@ -1606,11 +1606,6 @@ _formi_redraw_field(FORM *form, int field)
}
}
if (form->cur_field == field)
wattrset(form->scrwin, cur->fore);
else
wattrset(form->scrwin, cur->back);
str = &row->string[cur->start_char];
#ifdef DEBUG
@ -1631,11 +1626,14 @@ _formi_redraw_field(FORM *form, int field)
_formi_dbg_printf("%s: %s\n", __func__, buffer);
#endif
wattrset(form->scrwin, cur->back);
for (i = start + cur->start_char; i < pre; i++)
waddch(form->scrwin, cur->pad);
_formi_dbg_printf("%s: will add %d chars\n", __func__,
min(slen, flen));
wattrset(form->scrwin, cur->fore);
for (i = 0, cpos = cur->start_char; i < min(slen, flen);
i++, str++, cpos++)
{
@ -1647,8 +1645,11 @@ _formi_redraw_field(FORM *form, int field)
if (c == '\t')
tab = add_tab(form, row, cpos,
cur->pad);
else
else {
wattrset(form->scrwin, cur->back);
waddch(form->scrwin, cur->pad);
wattrset(form->scrwin, cur->fore);
}
} else if ((cur->opts & O_VISIBLE) == O_VISIBLE) {
if (c == '\t')
tab = add_tab(form, row, cpos, ' ');
@ -1670,6 +1671,7 @@ _formi_redraw_field(FORM *form, int field)
i += tab - 1;
}
wattrset(form->scrwin, cur->back);
for (i = 0; i < post; i++)
waddch(form->scrwin, cur->pad);
}
@ -1678,10 +1680,7 @@ _formi_redraw_field(FORM *form, int field)
wmove(form->scrwin, (int) (cur->form_row + i),
(int) cur->form_col);
if (form->cur_field == field)
wattrset(form->scrwin, cur->fore);
else
wattrset(form->scrwin, cur->back);
wattrset(form->scrwin, cur->back);
for (j = 0; j < cur->cols; j++) {
waddch(form->scrwin, cur->pad);