changeset 23651:dcd6688d67be

(MULTIBYTE_BYTES_WIDTH): Check validity of a multibyte character.
author Kenichi Handa <handa@m17n.org>
date Fri, 06 Nov 1998 00:44:16 +0000
parents 3cc42e65f25b
children 42bf6553a2e9
files src/indent.c
diffstat 1 files changed, 9 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/indent.c	Fri Nov 06 00:44:16 1998 +0000
+++ b/src/indent.c	Fri Nov 06 00:44:16 1998 +0000
@@ -308,13 +308,17 @@
 	bytes = BYTES_BY_CHAR_HEAD (c);					\
 	if (bytes >= 2 && bytes <= pend - p)				\
 	  {								\
-	    int ch;							\
+	    int ch = STRING_CHAR (p, bytes);				\
 	    								\
-	    if (dp && (ch = STRING_CHAR (p, bytes),			\
-		       VECTORP (DISP_CHAR_VECTOR (dp, ch))))		\
-	      width = XVECTOR (DISP_CHAR_VECTOR (dp, ch))->size;	\
+	    if (CHAR_VALID_P (ch, 0))					\
+	      {								\
+		if (dp && VECTORP (DISP_CHAR_VECTOR (dp, ch)))		\
+		  width = XVECTOR (DISP_CHAR_VECTOR (dp, ch))->size;	\
+		else							\
+		  width = WIDTH_BY_CHAR_HEAD (c);			\
+	      }								\
 	    else							\
-	      width = WIDTH_BY_CHAR_HEAD (c);				\
+	      width = bytes * 4;					\
 	    if (width > 1)						\
 	      wide_column = width;					\
 	  }								\