Module Name: src
Committed By: blymn
Date: Tue Jun 15 22:18:55 UTC 2021
Modified Files:
src/lib/libcurses: addbytes.c
Log Message:
Correct a previous fix for PR lib/56224.
Use wdwitch to determine the width of a wide character on the screen not
the number from mbrtowc which is the number of bytes in the character.
Thanks to Michael Forney for spotting this.
To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/lib/libcurses/addbytes.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/lib/libcurses/addbytes.c
diff -u src/lib/libcurses/addbytes.c:1.55 src/lib/libcurses/addbytes.c:1.56
--- src/lib/libcurses/addbytes.c:1.55 Sun Jun 6 05:06:44 2021
+++ src/lib/libcurses/addbytes.c Tue Jun 15 22:18:55 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: addbytes.c,v 1.55 2021/06/06 05:06:44 blymn Exp $ */
+/* $NetBSD: addbytes.c,v 1.56 2021/06/15 22:18:55 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.55 2021/06/06 05:06:44 blymn Exp $");
+__RCSID("$NetBSD: addbytes.c,v 1.56 2021/06/15 22:18:55 blymn Exp $");
#endif
#endif /* not lint */
@@ -175,7 +175,7 @@ _cursesi_waddbytes(WINDOW *win, const ch
* screen and this character would take us past the
* end of the line then we are done.
*/
- if ((win->curx + n >= win->maxx) &&
+ if ((win->curx + wcwidth(wc) >= win->maxx) &&
(!(win->flags & __SCROLLOK)) &&
(win->cury == win->scr_b))
break;