From f1a717291bea6353dd5c2e22cd75974adc3510bb Mon Sep 17 00:00:00 2001
From: David Lawrence Ramsey <pooka109@gmail.com>
Date: Tue, 8 Nov 2005 02:24:17 +0000
Subject: [PATCH] correction: in mbwidth(), use the width of Unicode U+FFFD
 (Replacement Character) instead of hardcoding a width of one for unprintable
 characters

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3103 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
---
 ChangeLog   | 6 +++---
 src/chars.c | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 563ba332..8138155c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -76,9 +76,9 @@ CVS code -
 - chars.c:
   mbwidth()
 	- If wcwidth() returns -1 for the character passed in, treat the
-	  character as being one column wide instead of zero columns
-	  wide, since there are display problems that crop up with the
-	  latter approach. (DLR)
+	  character as having the width of Unicode U+FFFD (Replacement
+	  Character) instead of having zero width, since there are
+	  display problems that crop up with the latter approach. (DLR)
 - files.c:
   read_file()
 	- Remove apparently unneeded logic to handle a case where
diff --git a/src/chars.c b/src/chars.c
index c48e3484..531ffad0 100644
--- a/src/chars.c
+++ b/src/chars.c
@@ -300,7 +300,7 @@ int mbwidth(const char *c)
 	width = wcwidth(wc);
 
 	if (width == -1)
-	    width = 1;
+	    width = wcwidth(bad_wchar);
 
 	return width;
     } else
-- 
GitLab