Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libform Fix for PR lib/47397



details:   https://anonhg.NetBSD.org/src/rev/139696482bf6
branches:  trunk
changeset: 989907:139696482bf6
user:      blymn <blymn%NetBSD.org@localhost>
date:      Tue Oct 19 21:22:20 2021 +0000

description:
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.

diffstat:

 lib/libform/internals.c |  23 +++++++++++------------
 1 files changed, 11 insertions(+), 12 deletions(-)

diffs (78 lines):

diff -r ed1b3875699f -r 139696482bf6 lib/libform/internals.c
--- a/lib/libform/internals.c   Tue Oct 19 21:21:07 2021 +0000
+++ b/lib/libform/internals.c   Tue Oct 19 21:22:20 2021 +0000
@@ -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 @@
                        }
                }
 
-               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_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 @@
                                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 @@
                                i += tab - 1;
                }
 
+               wattrset(form->scrwin, cur->back);
                for (i = 0; i < post; i++)
                        waddch(form->scrwin, cur->pad);
        }
@@ -1678,10 +1680,7 @@
                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);



Home | Main Index | Thread Index | Old Index