Source-Changes-HG archive

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

[src/netbsd-10]: src/lib/libcurses Pull up following revision(s) (requested b...



details:   https://anonhg.NetBSD.org/src/rev/26a76c52bcbe
branches:  netbsd-10
changeset: 372705:26a76c52bcbe
user:      martin <martin%NetBSD.org@localhost>
date:      Wed Dec 21 09:38:38 2022 +0000

description:
Pull up following revision(s) (requested by blymn in ticket #15):

        lib/libcurses/slk.c: revision 1.21
        lib/libcurses/addbytes.c: revision 1.68

Backout change to addnstr that broke other applications as n should be
the number of bytes to add - for multibyte characters n will be > 1.

Fix __slk_draw to pass in the actual length of the label instead of
the default label length because wide characters may make the
actual string length longer than the slk display length.

diffstat:

 lib/libcurses/addbytes.c |  14 +++++---------
 lib/libcurses/slk.c      |   9 ++++++---
 2 files changed, 11 insertions(+), 12 deletions(-)

diffs (85 lines):

diff -r df9162a8d139 -r 26a76c52bcbe lib/libcurses/addbytes.c
--- a/lib/libcurses/addbytes.c  Wed Dec 21 09:36:42 2022 +0000
+++ b/lib/libcurses/addbytes.c  Wed Dec 21 09:38:38 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: addbytes.c,v 1.67 2022/12/12 21:14:15 blymn Exp $      */
+/*     $NetBSD: addbytes.c,v 1.67.2.1 2022/12/21 09:38:38 martin 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.67 2022/12/12 21:14:15 blymn Exp $");
+__RCSID("$NetBSD: addbytes.c,v 1.67.2.1 2022/12/21 09:38:38 martin Exp $");
 #endif
 #endif                         /* not lint */
 
@@ -118,7 +118,7 @@
        int             *py = &win->cury, *px = &win->curx, err;
        __LINE          *lp;
 #ifdef HAVE_WCHAR
-       int             n, width;
+       int             n;
        cchar_t         cc;
        wchar_t         wc;
        mbstate_t       st;
@@ -170,18 +170,14 @@
                }
 
                __CTRACE(__CTRACE_INPUT,
-                   "ADDBYTES WIDE(0x%x [%s], %x) at (%d, %d), ate %d bytes\n",
+                   "ADDBYTES WIDE(0x%04x [%s], %x) at (%d, %d), ate %d bytes\n",
                    (unsigned)wc, unctrl((unsigned)wc), attr, *py, *px, n);
                cc.vals[0] = wc;
                cc.elements = 1;
                cc.attributes = attr;
                err = _cursesi_addwchar(win, &lp, py, px, &cc, char_interp);
                bytes += n;
-
-               width = wcwidth(wc);
-               if (width < 0)
-                       width = 1;
-               count -= width;
+               count -= n;
 #endif
        }
 
diff -r df9162a8d139 -r 26a76c52bcbe lib/libcurses/slk.c
--- a/lib/libcurses/slk.c       Wed Dec 21 09:36:42 2022 +0000
+++ b/lib/libcurses/slk.c       Wed Dec 21 09:38:38 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: slk.c,v 1.20 2022/04/12 07:03:04 blymn Exp $   */
+/*     $NetBSD: slk.c,v 1.20.2.1 2022/12/21 09:38:38 martin Exp $      */
 
 /*-
  * Copyright (c) 2017 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 #include <sys/cdefs.h>
 #include <limits.h>
 #ifndef lint
-__RCSID("$NetBSD: slk.c,v 1.20 2022/04/12 07:03:04 blymn Exp $");
+__RCSID("$NetBSD: slk.c,v 1.20.2.1 2022/12/21 09:38:38 martin Exp $");
 #endif                         /* not lint */
 
 #include <limits.h>
@@ -819,6 +819,9 @@
        wchar_t wc[2];
 #endif
 
+       __CTRACE(__CTRACE_INPUT, "__slk_draw: screen %p, label %d\n", screen,
+           labnum);
+
        if (screen->slk_hidden)
                return OK;
 
@@ -834,7 +837,7 @@
                    (screen->slk_window->flags & __SCROLLOK) ||
                    ((l->x + screen->slk_label_len) < screen->slk_window->maxx)) {
                        retval = mvwaddnstr(screen->slk_window, 0, l->x,
-                           l->label, screen->slk_label_len);
+                           l->label, strlen(l->label));
                } else {
                        lcnt = 0;
                        tx = 0;



Home | Main Index | Thread Index | Old Index