Source-Changes-HG archive

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

[src/trunk]: src/lib/libcurses Correct a previous fix for PR lib/56224.



details:   https://anonhg.NetBSD.org/src/rev/b7c27fa86760
branches:  trunk
changeset: 983962:b7c27fa86760
user:      blymn <blymn%NetBSD.org@localhost>
date:      Tue Jun 15 22:18:55 2021 +0000

description:
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:

 lib/libcurses/addbytes.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r 1df9d6467652 -r b7c27fa86760 lib/libcurses/addbytes.c
--- a/lib/libcurses/addbytes.c  Tue Jun 15 20:46:45 2021 +0000
+++ b/lib/libcurses/addbytes.c  Tue Jun 15 22:18:55 2021 +0000
@@ -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 @@
                 * 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;



Home | Main Index | Thread Index | Old Index