Dear Bram and list,

On Saturday, August 24, 2013 1:54:14 PM UTC+2, glts wrote:
> On Mon, Aug 19, 2013 at 12:41 AM, Jesus Antonio Santos Giraldo
> <[email protected]> wrote:
> > Almost a year later since last comment, Vim 7.4 is out... and again there 
> > is no *space* option for listchars... :( :( :(
> >
> > Maybe anyone has implemented this patch in 7.4? If so, I really appreciate 
> > it.
> > As I said a year ago, "It would be very, very, very usefull for my work".
> >
> >
> > J.
> >
> > El viernes, 31 de agosto de 2012 17:34:16 UTC-5, Jesus Antonio Santos 
> > Giraldo escribió:
> >> El lunes, 27 de agosto de 2012 05:59:48 UTC-5, 柳永峰 escribió:
> >> > hi thanks,it's very useful to me
> >> >
> >> > On Wednesday, October 21, 2009 10:26:10 PM UTC+8, Arkanosis wrote:
> >> > > Hello,
> >> > >
> >> > > I've just started to use Vim, and missed the possibility to display
> >> > > middle-dots (or any other visible character) instead of spaces, so I
> >> > > made the following patch.
> >> > > It adds "space" in the allowed "listchars" arguments.
> >> > >
> >> > > Just in case someone find this useful ; I found easier to patch Vim
> >> > > than to look for another existing solution ;-)
> >> > >
> >> > > Best regards,
> >> > >
> >> > > Index: option.c
> >> > > ===================================================================
> >> > > --- option.c      (revision 1626)
> >> > > +++ 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: screen.c
> >> > > ===================================================================
> >> > > --- screen.c      (revision 1626)
> >> > > +++ screen.c      (working copy)
> >> > > @@ -3886,6 +3886,18 @@
> >> > >  #endif
> >> > >       }
> >> > >
> >> > > +     /* 'list' : change space to lcs_space. */
> >> > > +     if (wp->w_p_list && c == ' ' && lcs_space)
> >> > > +     {
> >> > > +         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 */
> >> > > +         }
> >> > > +     }
> >> > > +
> >> > >       if (extra_check)
> >> > >       {
> >> > >  #ifdef FEAT_SPELL
> >> > > @@ -4040,7 +4052,7 @@
> >> > >           }
> >> > >  #endif
> >> > >
> >> > > -         if (trailcol != MAXCOL && ptr > line + trailcol && c == ' ')
> >> > > +         if (trailcol != MAXCOL && ptr > line + trailcol && (c == ' ' 
> >> > > || c
> >> > > == lcs_space))
> >> > >           {
> >> > >               c = lcs_trail;
> >> > >               if (!attr_pri)
> >> > > Index: globals.h
> >> > > ===================================================================
> >> > > --- globals.h     (revision 1626)
> >> > > +++ 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
> >>
> >> That would be very useful for me!
> >>
> >>
> >>
> >> I'm developing a plaint text file now and was very excited while reading 
> >> how listchars works specially the trail option. However almost immediately 
> >> I find myself googling the way to convert middle-dots... until I found 
> >> this thread.
> >>
> >>
> >>
> >> So, really, I can see real benefits from having this, besides looking the 
> >> patch it seems not so difficult to merge or maintain... ( Things are 
> >> easier to do if you don't have to do them yourself ;) )
> >>
> >>
> >>
> >> If you ever consider the possibility of including this count me on to test 
> >> it.
>
> Bram,
>
> I've updated and tightened the patch a bit. Printing of lcs_space with
> :list was missing, I added this. There were a few stray spaces in the
> help, I cleaned this up too, while I was at it. I also added tests, for
> 'list' and :list.
>
> By the way: introducing the new screenchar() to the test suite, it was
> quite useful for writing the test.
>
> I figured a little less complaining, a little more action would be in
> order. :)

I have updated this patch to apply cleanly to the current Vim version
7.4.471.

Anecdote to accompany the patch. If you wish, take a look at this
screenshot I took the other day:
https://raw.githubusercontent.com/glts/listchars-example/master/listchars-example.png
Looks like a tab-separated values file, doesn't it? Unfortunately, in
some columns tab is followed by one space, and this remains hidden even
though 'list' is set. This one took a minute to figure out ...

Thanks,
and have a nice day.


-- 
David Bürgin

-- 
-- 
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.

Attachment: listchars-space.patch
Description: Binary data

Raspunde prin e-mail lui