Source-Changes-HG archive

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

[src/trunk]: src/lib/libcurses Make the default colour pair be pair 0 which a...



details:   https://anonhg.NetBSD.org/src/rev/b67cf7d3c04e
branches:  trunk
changeset: 365191:b67cf7d3c04e
user:      blymn <blymn%NetBSD.org@localhost>
date:      Tue Apr 12 07:03:04 2022 +0000

description:
Make the default colour pair be pair 0 which appears to match other
curses implementations.

diffstat:

 lib/libcurses/add_wchstr.c     |    9 +-
 lib/libcurses/addbytes.c       |   10 +-
 lib/libcurses/attributes.c     |    6 +-
 lib/libcurses/background.c     |    8 +-
 lib/libcurses/border.c         |   18 +-
 lib/libcurses/clrtobot.c       |    8 +-
 lib/libcurses/clrtoeol.c       |    8 +-
 lib/libcurses/color.c          |   16 ++-
 lib/libcurses/copywin.c        |    6 +-
 lib/libcurses/curses_private.h |    4 +-
 lib/libcurses/delch.c          |    6 +-
 lib/libcurses/erase.c          |   11 +-
 lib/libcurses/get_wstr.c       |    6 +-
 lib/libcurses/ins_wch.c        |    6 +-
 lib/libcurses/ins_wstr.c       |    6 +-
 lib/libcurses/insdelln.c       |   14 +-
 lib/libcurses/mvwin.c          |    6 +-
 lib/libcurses/newwin.c         |   13 +-
 lib/libcurses/refresh.c        |  242 ++++++++++++++++++++++++----------------
 lib/libcurses/shlib_version    |    4 +-
 lib/libcurses/slk.c            |    5 +-
 lib/libcurses/touchwin.c       |   17 +-
 22 files changed, 235 insertions(+), 194 deletions(-)

diffs (truncated from 1275 to 300 lines):

diff -r 01be6f66adf9 -r b67cf7d3c04e lib/libcurses/add_wchstr.c
--- a/lib/libcurses/add_wchstr.c        Mon Apr 11 21:23:07 2022 +0000
+++ b/lib/libcurses/add_wchstr.c        Tue Apr 12 07:03:04 2022 +0000
@@ -1,4 +1,4 @@
-/*   $NetBSD: add_wchstr.c,v 1.11 2022/01/25 03:05:06 blymn Exp $ */
+/*   $NetBSD: add_wchstr.c,v 1.12 2022/04/12 07:03:04 blymn Exp $ */
 
 /*
  * Copyright (c) 2005 The NetBSD Foundation Inc.
@@ -36,7 +36,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: add_wchstr.c,v 1.11 2022/01/25 03:05:06 blymn Exp $");
+__RCSID("$NetBSD: add_wchstr.c,v 1.12 2022/04/12 07:03:04 blymn Exp $");
 #endif                         /* not lint */
 
 #include <stdlib.h>
@@ -170,7 +170,7 @@
                if (wcwidth(chp->vals[0])) {
                        /* clear the partial character before cursor */
                        for (tp = lp + cw; tp < lp; tp++) {
-                               tp->ch = (wchar_t) btowc((int) win->bch);
+                               tp->ch = win->bch;
                                if (_cursesi_copy_nsp(win->bnsp, tp) == ERR)
                                        return ERR;
                                tp->attr = win->battr;
@@ -205,8 +205,7 @@
                        if (cw > win->maxx - ex) {
                                /* clear to EOL */
                                while (ex < win->maxx) {
-                                       lp->ch = (wchar_t)
-                                               btowc((int) win->bch);
+                                       lp->ch = win->bch;
                                        if (_cursesi_copy_nsp(win->bnsp, lp)
                                            == ERR)
                                                return ERR;
diff -r 01be6f66adf9 -r b67cf7d3c04e lib/libcurses/addbytes.c
--- a/lib/libcurses/addbytes.c  Mon Apr 11 21:23:07 2022 +0000
+++ b/lib/libcurses/addbytes.c  Tue Apr 12 07:03:04 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: addbytes.c,v 1.61 2022/01/25 03:05:06 blymn Exp $      */
+/*     $NetBSD: addbytes.c,v 1.62 2022/04/12 07:03:04 blymn Exp $      */
 
 /*
  * Copyright (c) 1987, 1993, 1994
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)addbytes.c 8.4 (Berkeley) 5/4/94";
 #else
-__RCSID("$NetBSD: addbytes.c,v 1.61 2022/01/25 03:05:06 blymn Exp $");
+__RCSID("$NetBSD: addbytes.c,v 1.62 2022/04/12 07:03:04 blymn Exp $");
 #endif
 #endif                         /* not lint */
 
@@ -448,7 +448,7 @@
                            "_cursesi_addwchar: clear current char (%d,%d)\n",
                            *y, sx);
                        tp = &win->alines[*y]->line[sx];
-                       tp->ch = (wchar_t) btowc((int) win->bch);
+                       tp->ch = win->bch;
                        if (_cursesi_copy_nsp(win->bnsp, tp) == ERR)
                                return ERR;
 
@@ -481,7 +481,7 @@
                if (newx < *(*lnp)->firstchp)
                        *(*lnp)->firstchp = newx;
                for (tp = lp; *x < win->maxx; tp++, (*x)++) {
-                       tp->ch = (wchar_t) btowc((int) win->bch);
+                       tp->ch = win->bch;
                        if (_cursesi_copy_nsp(win->bnsp, tp) == ERR)
                                return ERR;
                        tp->attr = win->battr;
@@ -595,7 +595,7 @@
                                    "_cursesi_addwchar: clear "
                                    "remaining of current char (%d,%d)nn",
                                    *y, ex);
-                               tp->ch = (wchar_t) btowc((int) win->bch);
+                               tp->ch = win->bch;
                                if (_cursesi_copy_nsp(win->bnsp, tp) == ERR)
                                        return ERR;
                                tp->attr = win->battr;
diff -r 01be6f66adf9 -r b67cf7d3c04e lib/libcurses/attributes.c
--- a/lib/libcurses/attributes.c        Mon Apr 11 21:23:07 2022 +0000
+++ b/lib/libcurses/attributes.c        Tue Apr 12 07:03:04 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: attributes.c,v 1.33 2021/12/08 20:50:01 andvar Exp $   */
+/*     $NetBSD: attributes.c,v 1.34 2022/04/12 07:03:04 blymn Exp $    */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: attributes.c,v 1.33 2021/12/08 20:50:01 andvar Exp $");
+__RCSID("$NetBSD: attributes.c,v 1.34 2022/04/12 07:03:04 blymn Exp $");
 #endif                         /* not lint */
 
 #include "curses.h"
@@ -460,6 +460,6 @@
        /* If another color pair is set, turn that off first. */
        win->wattr &= ~__COLOR;
        /* If can do color video, set the color pair bits. */
-       if (t_max_colors(t) != 0 && attr & __COLOR)
+       if (t_max_colors(t) != 0)
                win->wattr |= attr & __COLOR;
 }
diff -r 01be6f66adf9 -r b67cf7d3c04e lib/libcurses/background.c
--- a/lib/libcurses/background.c        Mon Apr 11 21:23:07 2022 +0000
+++ b/lib/libcurses/background.c        Tue Apr 12 07:03:04 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: background.c,v 1.28 2022/01/25 03:05:06 blymn Exp $    */
+/*     $NetBSD: background.c,v 1.29 2022/04/12 07:03:04 blymn Exp $    */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: background.c,v 1.28 2022/01/25 03:05:06 blymn Exp $");
+__RCSID("$NetBSD: background.c,v 1.29 2022/04/12 07:03:04 blymn Exp $");
 #endif                         /* not lint */
 
 #include <stdlib.h>
@@ -110,7 +110,7 @@
 #endif
                }
        }
-       __touchwin(win);
+       __touchwin(win, 1);
        return OK;
 }
 
@@ -230,7 +230,7 @@
                return ERR;
 
        wbkgrndset(win, wch);
-       __touchwin(win);
+       __touchwin(win, 1);
        return OK;
 }
 
diff -r 01be6f66adf9 -r b67cf7d3c04e lib/libcurses/border.c
--- a/lib/libcurses/border.c    Mon Apr 11 21:23:07 2022 +0000
+++ b/lib/libcurses/border.c    Tue Apr 12 07:03:04 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: border.c,v 1.22 2022/01/25 03:05:06 blymn Exp $        */
+/*     $NetBSD: border.c,v 1.23 2022/04/12 07:03:04 blymn Exp $        */
 
 /*
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: border.c,v 1.22 2022/01/25 03:05:06 blymn Exp $");
+__RCSID("$NetBSD: border.c,v 1.23 2022/04/12 07:03:04 blymn Exp $");
 #endif                         /* not lint */
 
 #include <stdlib.h>
@@ -154,7 +154,7 @@
                lp[endx].ch = (wchar_t) botright & __CHARTEXT;
                lp[endx].attr = (attr_t) botright & __ATTRIBUTES;
        }
-       __touchwin(win);
+       __touchwin(win, 0);
        return OK;
 #else /* HAVE_WCHAR */
        cchar_t ls, rs, ts, bs, tl, tr, bl, br;
@@ -331,7 +331,7 @@
                for (j = cw; win->alines[i]->line[j].wcols < 0; j++) {
                        __CTRACE(__CTRACE_INPUT,
                            "wborder_set: clean out partial char[%d]", j);
-                       win->alines[i]->line[j].ch = ( wchar_t )btowc(win->bch);
+                       win->alines[i]->line[j].ch = win->bch;
                        if (_cursesi_copy_nsp(win->bnsp,
                                              &win->alines[i]->line[j]) == ERR)
                                return ERR;
@@ -377,8 +377,7 @@
                            endx - cw + pcw, endx - cw);
                        k = pcw < 0 ? endx -cw + pcw : endx - cw;
                        for (j = endx - cw; j >= k; j--) {
-                               win->alines[i]->line[j].ch
-                                       = (wchar_t)btowc(win->bch);
+                               win->alines[i]->line[j].ch = win->bch;
                                if (_cursesi_copy_nsp(win->bnsp,
                                               &win->alines[i]->line[j]) == ERR)
                                        return ERR;
@@ -435,8 +434,7 @@
                }
        }
        while (i <= endx - trcw) {
-               win->alines[0]->line[i].ch =
-                       (wchar_t)btowc((int) win->bch);
+               win->alines[0]->line[i].ch = win->bch;
                if (_cursesi_copy_nsp(win->bnsp,
                                      &win->alines[0]->line[i]) == ERR)
                        return ERR;
@@ -476,7 +474,7 @@
                }
        }
        while (i <= endx - brcw) {
-               win->alines[endy]->line[i].ch = (wchar_t)btowc((int) win->bch );
+               win->alines[endy]->line[i].ch = win->bch;
                if (_cursesi_copy_nsp(win->bnsp,
                                      &win->alines[endy]->line[i]) == ERR)
                        return ERR;
@@ -603,7 +601,7 @@
                                    endx - brcw + 1 - i;
                }
        }
-       __touchwin(win);
+       __touchwin(win, 0);
        return OK;
 #endif /* HAVE_WCHAR */
 }
diff -r 01be6f66adf9 -r b67cf7d3c04e lib/libcurses/clrtobot.c
--- a/lib/libcurses/clrtobot.c  Mon Apr 11 21:23:07 2022 +0000
+++ b/lib/libcurses/clrtobot.c  Tue Apr 12 07:03:04 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: clrtobot.c,v 1.28 2022/01/25 03:05:06 blymn Exp $      */
+/*     $NetBSD: clrtobot.c,v 1.29 2022/04/12 07:03:04 blymn Exp $      */
 
 /*
  * Copyright (c) 1981, 1993, 1994
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)clrtobot.c 8.2 (Berkeley) 5/4/94";
 #else
-__RCSID("$NetBSD: clrtobot.c,v 1.28 2022/01/25 03:05:06 blymn Exp $");
+__RCSID("$NetBSD: clrtobot.c,v 1.29 2022/04/12 07:03:04 blymn Exp $");
 #endif
 #endif                         /* not lint */
 
@@ -68,11 +68,7 @@
        wchar_t bch;
        attr_t  battr;
 
-#ifdef HAVE_WCHAR
-       bch = (wchar_t)btowc((int)win->bch);
-#else
        bch = win->bch;
-#endif
        if (win != curscr)
                battr = win->battr & __ATTRIBUTES;
        else
diff -r 01be6f66adf9 -r b67cf7d3c04e lib/libcurses/clrtoeol.c
--- a/lib/libcurses/clrtoeol.c  Mon Apr 11 21:23:07 2022 +0000
+++ b/lib/libcurses/clrtoeol.c  Tue Apr 12 07:03:04 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: clrtoeol.c,v 1.33 2022/01/25 03:05:06 blymn Exp $      */
+/*     $NetBSD: clrtoeol.c,v 1.34 2022/04/12 07:03:04 blymn Exp $      */
 
 /*
  * Copyright (c) 1981, 1993, 1994
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)clrtoeol.c 8.2 (Berkeley) 5/4/94";
 #else
-__RCSID("$NetBSD: clrtoeol.c,v 1.33 2022/01/25 03:05:06 blymn Exp $");
+__RCSID("$NetBSD: clrtoeol.c,v 1.34 2022/04/12 07:03:04 blymn Exp $");
 #endif
 #endif                         /* not lint */
 
@@ -68,11 +68,7 @@
        wchar_t bch;
        attr_t  battr;
 
-#ifdef HAVE_WCHAR
-       bch = (wchar_t)btowc((int)win->bch);
-#else
        bch = win->bch;
-#endif
        if (win != curscr)
                battr = win->battr & __ATTRIBUTES;
        else
diff -r 01be6f66adf9 -r b67cf7d3c04e lib/libcurses/color.c
--- a/lib/libcurses/color.c     Mon Apr 11 21:23:07 2022 +0000
+++ b/lib/libcurses/color.c     Tue Apr 12 07:03:04 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: color.c,v 1.45 2021/12/17 03:50:18 uwe Exp $   */
+/*     $NetBSD: color.c,v 1.46 2022/04/12 07:03:04 blymn Exp $ */
 
 /*
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: color.c,v 1.45 2021/12/17 03:50:18 uwe Exp $");
+__RCSID("$NetBSD: color.c,v 1.46 2022/04/12 07:03:04 blymn Exp $");
 #endif                         /* not lint */
 
 #include "curses.h"
@@ -39,6 +39,7 @@
 
 /* Have we initialised colours? */
 int    __using_color = 0;



Home | Main Index | Thread Index | Old Index