From fb9117773df724c8db96c544958374d953ca0012 Mon Sep 17 00:00:00 2001 From: Karl Heuer Date: Sat, 15 Nov 1997 20:22:20 +0000 Subject: [PATCH] (position_indentation): Detect non-breaking space, in either single-byte form or multibyte form (using category ' '). --- src/indent.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/indent.c b/src/indent.c index 3a8cce764df..b6806f628f7 100644 --- a/src/indent.c +++ b/src/indent.c @@ -23,6 +23,7 @@ Boston, MA 02111-1307, USA. */ #include "lisp.h" #include "buffer.h" #include "charset.h" +#include "category.h" #include "indent.h" #include "frame.h" #include "window.h" @@ -680,6 +681,9 @@ position_indentation (pos) } switch (*p++) { + case 0240: + if (! NILP (current_buffer->enable_multibyte_characters)) + return column; case ' ': column++; break; @@ -687,7 +691,21 @@ position_indentation (pos) column += tab_width - column % tab_width; break; default: - return column; + if (ASCII_BYTE_P (p[-1]) + || NILP (current_buffer->enable_multibyte_characters)) + return column; + { + int pos = PTR_CHAR_POS (p - 1); + int c = FETCH_MULTIBYTE_CHAR (pos); + if (CHAR_HAS_CATEGORY (c, ' ')) + { + column++; + INC_POS (pos); + p = POS_ADDR (pos); + } + else + return column; + } } } } -- 2.39.2