Bram,
Vim is treating U+0160 special with the listchars flag "nbsp".
But there are more non-breaking spaces, e.g. U+202F (narrow no-break 
space) and U+FEFF (zero width no-break space).

So here is a patch, that will also use the nbsp flag for those two chars 
as well.

Also, one could argue, U+FEFF should be displayed as ' ' and not as 
<feff> but for now I leave it as is.

Best,
Christian
-- 
Statt sich beim Humoristen über seine Gottlosigkeit sollten sich
manche lieber bei Gott über ihre Humorlosigkeit beklagen.
                -- Hans-Hermann Kesten

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -4747,7 +4747,8 @@ A jump table for the options with a shor
 			'conceallevel' is set to 1.
 							*lcs-nbsp*
 	  nbsp:c	Character to show for a non-breakable space (character
-			0xA0, 160).  Left blank when omitted.
+			0xA0, U+0160, U+202F, U+FEFF).  Left blank when omitted
+			(except for U+FEFF)
 
 	The characters ':' and ',' should not be used.  UTF-8 characters can
 	be used when 'encoding' is "utf-8", otherwise only printable
diff --git a/src/charset.c b/src/charset.c
--- a/src/charset.c
+++ b/src/charset.c
@@ -822,6 +822,8 @@ vim_strnsize(s, len)
 	ts = (buf)->b_p_ts; \
 	return (int)(ts - (col % ts)); \
     } \
+    else if (((wp)->w_p_list && lcs_nbsp && utf_ptr2char(p) == 0xfeff)) \
+	return 1; \
     else \
 	return ptr2cells(p);
 
@@ -1256,7 +1258,10 @@ win_nolbr_chartabsize(wp, s, col, headp)
 	n = wp->w_buffer->b_p_ts;
 	return (int)(n - (col % n));
     }
-    n = ptr2cells(s);
+    else if (wp->w_p_list && lcs_nbsp && utf_ptr2char(s) == 0xfeff)
+	n = 1;
+    else
+	n = ptr2cells(s);
     /* Add one cell for a double-width character in the last column of the
      * window, displayed with a ">". */
     if (n == 2 && MB_BYTE2LEN(*s) > 1 && in_win_border(wp, col))
@@ -1366,7 +1371,12 @@ getvcol(wp, pos, start, cursor, end)
 		    /* For utf-8, if the byte is >= 0x80, need to look at
 		     * further bytes to find the cell width. */
 		    if (enc_utf8 && c >= 0x80)
-			incr = utf_ptr2cells(ptr);
+		    {
+			if (wp->w_p_list && lcs_nbsp != NUL && utf_ptr2char(ptr) == 0xfeff)
+			    incr = 1;
+			else
+			    incr = utf_ptr2cells(ptr);
+		    }
 		    else
 			incr = CHARSIZE(c);
 
diff --git a/src/message.c b/src/message.c
--- a/src/message.c
+++ b/src/message.c
@@ -1697,7 +1697,10 @@ msg_prt_line(s, list)
 	else if (has_mbyte && (l = (*mb_ptr2len)(s)) > 1)
 	{
 	    col += (*mb_ptr2cells)(s);
-	    if (lcs_nbsp != NUL && list && mb_ptr2char(s) == 160)
+	    if (lcs_nbsp != NUL && list && (
+		    mb_ptr2char(s) == 160 ||
+		    mb_ptr2char(s) == 0x202f ||
+		    mb_ptr2char(s) == 0xfeff))
 	    {
 		mb_char2bytes(lcs_nbsp, buf);
 		buf[(*mb_ptr2len)(buf)] = NUL;
diff --git a/src/screen.c b/src/screen.c
--- a/src/screen.c
+++ b/src/screen.c
@@ -4174,13 +4174,16 @@ win_line(wp, lnum, startrow, endrow, noc
 			}
 		    }
 
-		    if ((mb_l == 1 && c >= 0x80)
+		    if (((mb_l == 1 && c >= 0x80)
 			    || (mb_l >= 1 && mb_c == 0)
 			    || (mb_l > 1 && (!vim_isprintc(mb_c)
 # ifdef UNICODE16
 							 || mb_c >= 0x10000
 # endif
-							 )))
+							 ))) &&
+			    /* U+FEFF Unicode NO-BREAK Space will be handled in list mode
+			     * further down */
+			    !(wp->w_p_list && lcs_nbsp && mb_c == 0xfeff))
 		    {
 			/*
 			 * Illegal UTF-8 byte: display as <xx>.
@@ -4338,7 +4341,7 @@ win_line(wp, lnum, startrow, endrow, noc
 	    if (wp->w_p_list
 		    && (((c == 160
 #ifdef FEAT_MBYTE
-			  || (mb_utf8 && mb_c == 160)
+			  || (mb_utf8 && (mb_c == 160 || mb_c == 0xfeff || mb_c == 0x202f))
 #endif
 			 ) && lcs_nbsp)
 			|| (c == ' ' && lcs_space && ptr <= line + trailcol)))

Raspunde prin e-mail lui