Module Name:    src
Committed By:   christos
Date:           Thu Dec  5 22:21:53 UTC 2024

Modified Files:
        src/lib/libedit: literal.c refresh.c

Log Message:
Don't eat 0 width characters, print them.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/lib/libedit/literal.c
cvs rdiff -u -r1.59 -r1.60 src/lib/libedit/refresh.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/libedit/literal.c
diff -u src/lib/libedit/literal.c:1.5 src/lib/libedit/literal.c:1.6
--- src/lib/libedit/literal.c:1.5	Tue Jul 23 09:10:11 2019
+++ src/lib/libedit/literal.c	Thu Dec  5 17:21:53 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: literal.c,v 1.5 2019/07/23 13:10:11 christos Exp $	*/
+/*	$NetBSD: literal.c,v 1.6 2024/12/05 22:21:53 christos Exp $	*/
 
 /*-
  * Copyright (c) 2017 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include "config.h"
 #if !defined(lint) && !defined(SCCSID)
-__RCSID("$NetBSD: literal.c,v 1.5 2019/07/23 13:10:11 christos Exp $");
+__RCSID("$NetBSD: literal.c,v 1.6 2024/12/05 22:21:53 christos Exp $");
 #endif /* not lint && not SCCSID */
 
 /*
@@ -85,7 +85,7 @@ literal_add(EditLine *el, const wchar_t 
 	w = wcwidth(end[1]);	/* column width of the visible char */
 	*wp = (int)w;
 
-	if (w <= 0)		/* we require something to be printed */
+	if (w < 0)		/* non-printable characters are negative */
 		return 0;
 
 	len = (size_t)(end - buf);

Index: src/lib/libedit/refresh.c
diff -u src/lib/libedit/refresh.c:1.59 src/lib/libedit/refresh.c:1.60
--- src/lib/libedit/refresh.c:1.59	Sun Jun 30 13:11:27 2024
+++ src/lib/libedit/refresh.c	Thu Dec  5 17:21:53 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: refresh.c,v 1.59 2024/06/30 17:11:27 christos Exp $	*/
+/*	$NetBSD: refresh.c,v 1.60 2024/12/05 22:21:53 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)refresh.c	8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: refresh.c,v 1.59 2024/06/30 17:11:27 christos Exp $");
+__RCSID("$NetBSD: refresh.c,v 1.60 2024/12/05 22:21:53 christos Exp $");
 #endif
 #endif /* not lint && not SCCSID */
 
@@ -168,7 +168,7 @@ re_putliteral(EditLine *el, const wchar_
 	int i, w;
 
 	c = literal_add(el, begin, end, &w);
-	if (c == 0 || w <= 0)
+	if (c == 0 || w < 0)
 		return;
 	el->el_vdisplay[cur->v][cur->h] = c;
 
@@ -178,7 +178,7 @@ re_putliteral(EditLine *el, const wchar_
 	while (--i > 0)
 		el->el_vdisplay[cur->v][cur->h + i] = MB_FILL_CHAR;
 
-	cur->h += w;
+	cur->h += w ? w : 1;
 	if (cur->h >= sizeh) {
 		/* assure end of line */
 		el->el_vdisplay[cur->v][sizeh] = '\0';
@@ -212,7 +212,7 @@ re_putc(EditLine *el, wint_t c, int shif
 	if (!shift)
 		return;
 
-	cur->h += w;	/* advance to next place */
+	cur->h += w ? w : 1;	/* advance to next place */
 	if (cur->h >= sizeh) {
 		/* assure end of line */
 		el->el_vdisplay[cur->v][sizeh] = '\0';

Reply via email to