Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libcurses Default the character width to 1 if wcwidth fa...
details: https://anonhg.NetBSD.org/src/rev/b0285b4101d4
branches: trunk
changeset: 372619:b0285b4101d4
user: blymn <blymn%NetBSD.org@localhost>
date: Mon Dec 12 21:14:15 2022 +0000
description:
Default the character width to 1 if wcwidth fails.
diffstat:
lib/libcurses/addbytes.c | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
diffs (40 lines):
diff -r bafe1fcb7d54 -r b0285b4101d4 lib/libcurses/addbytes.c
--- a/lib/libcurses/addbytes.c Mon Dec 12 18:22:32 2022 +0000
+++ b/lib/libcurses/addbytes.c Mon Dec 12 21:14:15 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: addbytes.c,v 1.66 2022/11/07 21:18:49 blymn Exp $ */
+/* $NetBSD: addbytes.c,v 1.67 2022/12/12 21:14:15 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.66 2022/11/07 21:18:49 blymn Exp $");
+__RCSID("$NetBSD: addbytes.c,v 1.67 2022/12/12 21:14:15 blymn Exp $");
#endif
#endif /* not lint */
@@ -118,7 +118,7 @@
int *py = &win->cury, *px = &win->curx, err;
__LINE *lp;
#ifdef HAVE_WCHAR
- int n;
+ int n, width;
cchar_t cc;
wchar_t wc;
mbstate_t st;
@@ -177,7 +177,11 @@
cc.attributes = attr;
err = _cursesi_addwchar(win, &lp, py, px, &cc, char_interp);
bytes += n;
- count -= wcwidth(wc);
+
+ width = wcwidth(wc);
+ if (width < 0)
+ width = 1;
+ count -= width;
#endif
}
Home |
Main Index |
Thread Index |
Old Index