Ali Gholami Rudi <[email protected]> wrote:
> By the way, any ideas for handling NBSP (unicode 0x200C) and ZWJ
> (unicode 0x200D)?  Currently Vim shows them as "<200c>" and "<200d>".
> How to hide them?

This patch shows nbsp and zwj as a dash.  But it is a hack and not meant
for inclusion in the mainline.  Hope someone finds it useful.

Regards,
Ali

diff --git a/src/charset.c b/src/charset.c
--- a/src/charset.c
+++ b/src/charset.c
@@ -354,7 +354,7 @@ transstr(s)
                    len += l;
                else
                {
-                   transchar_hex(hexbuf, c);
+                   transchar_nonprint(hexbuf, c);
                    len += (int)STRLEN(hexbuf);
                }
            }
@@ -385,7 +385,7 @@ transstr(s)
                if (vim_isprintc(c))
                    STRNCAT(res, p, l); /* append printable multi-byte char */
                else
-                   transchar_hex(res + STRLEN(res), c);
+                   transchar_nonprint(res + STRLEN(res), c);
                p += l;
            }
            else
@@ -614,7 +614,11 @@ transchar_nonprint(buf, c)
 #ifdef FEAT_MBYTE
     else if (enc_utf8 && c >= 0x80)
     {
-       transchar_hex(buf, c);
+       if (c == 0x200c || c == 0x200d) {
+           buf[0] = '-';
+           buf[1] = NUL;
+       } else
+           transchar_hex(buf, c);
     }
 #endif
 #ifndef EBCDIC
diff --git a/src/mbyte.c b/src/mbyte.c
--- a/src/mbyte.c
+++ b/src/mbyte.c
@@ -1201,6 +1201,8 @@ utf_char2cells(c)
 
     if (c >= 0x100)
     {
+       if (c == 0x200c || c == 0x200d)
+           return 1;
 #ifdef USE_WCHAR_FUNCTIONS
        /*
         * Assume the library function wcwidth() works better than our own
diff --git a/src/screen.c b/src/screen.c
--- a/src/screen.c
+++ b/src/screen.c
@@ -3718,7 +3718,7 @@ win_line(wp, lnum, startrow, endrow, nochange)
                        if (mb_c < 0x10000)
 # endif
                        {
-                           transchar_hex(extra, mb_c);
+                           transchar_nonprint(extra, mb_c);
 # ifdef FEAT_RIGHTLEFT
                            if (wp->w_p_rl)             /* reverse */
                                rl_mirror(extra);

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Raspunde prin e-mail lui