From f35b0e56f0813b693f74c6c5e0101a9b23e0d547 Mon Sep 17 00:00:00 2001 From: Kenichi Handa Date: Fri, 6 Nov 1998 00:44:16 +0000 Subject: [PATCH] (MULTIBYTE_BYTES_WIDTH): Check validity of a multibyte character. --- src/indent.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/indent.c b/src/indent.c index 9ac2dd7315f..9528894baf2 100644 --- a/src/indent.c +++ b/src/indent.c @@ -308,13 +308,17 @@ skip_invisible (pos, next_boundary_p, to, window) 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; \ } \ -- 2.39.2