summaryrefslogtreecommitdiff
path: root/lib/libcurses/addbytes.c
diff options
context:
space:
mode:
authorblymn <blymn@NetBSD.org>2021-06-15 22:18:55 +0000
committerblymn <blymn@NetBSD.org>2021-06-15 22:18:55 +0000
commitd184f5802d44a96b415751291ff2dfd40049d83f (patch)
tree6f269c4662ae306749bc85eb737a925a364943e1 /lib/libcurses/addbytes.c
parentba1fb2c0883f988138919ea88c7d5a0bc74310ed (diff)
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.
Diffstat (limited to 'lib/libcurses/addbytes.c')
-rw-r--r--lib/libcurses/addbytes.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/libcurses/addbytes.c b/lib/libcurses/addbytes.c
index fbf177c255d..087ffec99f1 100644
--- a/lib/libcurses/addbytes.c
+++ b/lib/libcurses/addbytes.c
@@ -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 char *bytes, int count, attr_t attr,
* 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;