Source-Changes-HG archive

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

[src/trunk]: src/lib/libcurses Count character widths not number of bytes whe...



details:   https://anonhg.NetBSD.org/src/rev/f7f479746460
branches:  trunk
changeset: 372278:f7f479746460
user:      blymn <blymn%NetBSD.org@localhost>
date:      Mon Nov 07 21:18:49 2022 +0000

description:
Count character widths not number of bytes when calculating number
of characters to add.  Fixes an error detected by slk tests where
a label containing wide characters was not correctly printed.

diffstat:

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

diffs (27 lines):

diff -r 060b25b9d125 -r f7f479746460 lib/libcurses/addbytes.c
--- a/lib/libcurses/addbytes.c  Mon Nov 07 08:35:57 2022 +0000
+++ b/lib/libcurses/addbytes.c  Mon Nov 07 21:18:49 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: addbytes.c,v 1.65 2022/10/19 06:09:27 blymn Exp $      */
+/*     $NetBSD: addbytes.c,v 1.66 2022/11/07 21:18:49 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.65 2022/10/19 06:09:27 blymn Exp $");
+__RCSID("$NetBSD: addbytes.c,v 1.66 2022/11/07 21:18:49 blymn Exp $");
 #endif
 #endif                         /* not lint */
 
@@ -177,7 +177,7 @@
                cc.attributes = attr;
                err = _cursesi_addwchar(win, &lp, py, px, &cc, char_interp);
                bytes += n;
-               count -= n;
+               count -= wcwidth(wc);
 #endif
        }
 



Home | Main Index | Thread Index | Old Index