Hello,

2009/10/28 Bram Moolenaar <[email protected]>:
>> It adds "space" in the allowed "listchars" arguments.
> I'm confused.  It appears the "space" character is both used to display
> instead of a space character when 'list' is on, and to find this
> character after the end of the line and replace it with "trail".
> To me these are two unrelated things.

You are right. This was because spaces were already replaced at that
point, making the replacement with "trail" impossible.
But it leads to side effects if the "space replacement" character is
actually used in the edited file.

Here is a new patch without this annoying side-effect.

> I'm not sure how useful it is to show something instead of a space.
> Isn't it obvious that there is a space when there is nothing?

Sometimes it's not : I'm using a visible character for the first
column of tabs, but an invisible one for the remaining columns.
So cases where a tab is followed by a space are not that obvious.
And as Steve pointed out, double spaces are not always obvious either.

2009/10/29 Steve Hall <[email protected]>
> Bram, I can't speak for the author, but I'd like this feature to make
> it easy to visualize:
> * other non-printing characters that look like dec 032
> * double spaces
> * spaces after chars at window edges with wrap on
> * every char as a byte

As for now, only the ' ' character is displayed, but it'd easy to support more.

Best regards,

Index: src/option.c
===================================================================
--- src/option.c        (revision 1626)
+++ src/option.c        (working copy)
@@ -6847,6 +6847,7 @@
        {&lcs_ext,      "extends"},
        {&lcs_nbsp,     "nbsp"},
        {&lcs_prec,     "precedes"},
+       {&lcs_space,    "space"},
        {&lcs_tab2,     "tab"},
        {&lcs_trail,    "trail"},
     };
Index: src/screen.c
===================================================================
--- src/screen.c        (revision 1626)
+++ src/screen.c        (working copy)
@@ -3886,6 +3886,29 @@
 #endif
            }

+           /* 'list' : change space to lcs_space. */
+           if (wp->w_p_list && c == ' ' && lcs_space && ptr <= line + trailcol)
+           {
+               c = lcs_space;
+               if (area_attr == 0 && search_attr == 0)
+               {
+                   n_attr = 1;
+                   extra_attr = hl_attr(HLF_8);
+                   saved_attr2 = char_attr; /* save current attr */
+               }
+#ifdef FEAT_MBYTE
+               mb_c = c;
+               if (enc_utf8 && (*mb_char2len)(c) > 1)
+               {
+                   mb_utf8 = TRUE;
+                   u8cc[0] = 0;
+                   c = 0xc0;
+               }
+               else
+                   mb_utf8 = FALSE;
+#endif
+           }
+
            if (extra_check)
            {
 #ifdef FEAT_SPELL
Index: src/globals.h
===================================================================
--- src/globals.h       (revision 1626)
+++ src/globals.h       (working copy)
@@ -1146,6 +1146,7 @@
 EXTERN int     lcs_tab1 INIT(= NUL);
 EXTERN int     lcs_tab2 INIT(= NUL);
 EXTERN int     lcs_trail INIT(= NUL);
+EXTERN int     lcs_space INIT(= NUL);

 #if defined(FEAT_WINDOWS) || defined(FEAT_WILDMENU) || defined(FEAT_STL_OPT) \
        || defined(FEAT_FOLDING)


-- 
Jérémie Roquet - Arkanosis
Programming artist
Developer in natural language processing - Exalead

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

Raspunde prin e-mail lui