Module Name:    src
Committed By:   uwe
Date:           Thu Mar 28 23:24:22 UTC 2019

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

Log Message:
winwrite - using addch() on individual bytes of e.g. UTF-8 encoding
doesn't work that well.  addstr() the whole buffer instead.  This is
still not enirely correct b/c printf can run out of stdio buffer
mid-character for very long output, but deal with it later.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/lib/libcurses/printw.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/printw.c
diff -u src/lib/libcurses/printw.c:1.25 src/lib/libcurses/printw.c:1.26
--- src/lib/libcurses/printw.c:1.25	Thu Mar 21 21:28:55 2019
+++ src/lib/libcurses/printw.c	Thu Mar 28 23:24:22 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: printw.c,v 1.25 2019/03/21 21:28:55 uwe Exp $	*/
+/*	$NetBSD: printw.c,v 1.26 2019/03/28 23:24:22 uwe Exp $	*/
 
 /*
  * Copyright (c) 1981, 1993, 1994
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)printw.c	8.3 (Berkeley) 5/4/94";
 #else
-__RCSID("$NetBSD: printw.c,v 1.25 2019/03/21 21:28:55 uwe Exp $");
+__RCSID("$NetBSD: printw.c,v 1.26 2019/03/28 23:24:22 uwe Exp $");
 #endif
 #endif				/* not lint */
 
@@ -118,15 +118,12 @@ winwrite(void *cookie, const void *vbuf,
 {
 	WINDOW *win = cookie;
 	const char *buf = vbuf;
-	size_t c;
+	int status;
+
+	status = waddnstr(win, buf, n);
+	if (status == ERR)
+	    return -1;
 
-	for (c = 0; c < n; c++) {
-#ifdef DEBUG
-		__CTRACE(__CTRACE_MISC, "__winwrite: %c\n", *buf);
-#endif
-		if (waddch(win, (chtype) (*buf++ & __CHARTEXT)) == ERR)
-			return -1;
-	}
 	return (ssize_t)n;
 }
 /*

Reply via email to