Module Name:    src
Committed By:   blymn
Date:           Mon Nov  7 21:18:49 UTC 2022

Modified Files:
        src/lib/libcurses: addbytes.c

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 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.65 src/lib/libcurses/addbytes.c:1.66
--- src/lib/libcurses/addbytes.c:1.65	Wed Oct 19 06:09:27 2022
+++ src/lib/libcurses/addbytes.c	Mon Nov  7 21:18:49 2022
@@ -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 @@ _cursesi_waddbytes(WINDOW *win, const ch
 		cc.attributes = attr;
 		err = _cursesi_addwchar(win, &lp, py, px, &cc, char_interp);
 		bytes += n;
-		count -= n;
+		count -= wcwidth(wc);
 #endif
 	}
 

Reply via email to