Christian wrote:

> a popular questions at Stackoverflow covers the topic how to display
> whitespace distinct so that it is easily visible where whitespace is.
> Since starting with Vim 7.3 Concealing became available, my answer to
> that problem was this:
> 
> ,----
> | syn match WhiteSpace / / containedin=ALL conceal cchar=ยท
> | setl conceallevel=2 concealcursor=nv
> `----
> 
> That should theoretically match everywhere, but I noticed it doesn't. I
> have digged into the syntax highlighting rules and apparently, this is
> caused by the "skipwhite" argument in the syntax files. The help however
> states this:
> 
> ,----[ :h syn-skipwhite ]-
> | When "skipwhite" is present, the white space is only skipped if there
> | is no next group that matches the white space.
> `----
> 
> So I would argue, that a syntax rule, that has the containedin argument,
> should also apply at that space. The patch seems relativly simple:
> 
> diff --git a/src/syntax.c b/src/syntax.c
> --- a/src/syntax.c
> +++ b/src/syntax.c
> @@ -2275,12 +2275,14 @@ syn_current_attr(syncing, displaying, ca
>               * If a nextgroup was not found, continue looking for one 
> if:
>               * - this is an empty line and the "skipempty" option was 
> given
>               * - we are on white space and the "skipwhite" option was 
> given
> +            *   (but allow containedin groups to still match that)
>               */
>              if (!found_match)
>              {
>                  line = syn_getcurline();
>                  if (((current_next_flags & HL_SKIPWHITE)
> -                           && vim_iswhite(line[current_col]))
> +                           && vim_iswhite(line[current_col])
> +                           && !syn_block->b_syn_containedin)
>                          || ((current_next_flags & HL_SKIPEMPTY)
>                              && *line == NUL))
>                      break;
> 
> Attached is also a screenshot, that shows the difference.

Hmm, a nextgroup is something else than containedin.  I suspect this
might break some syntaxes in obscure ways.  I think consistency is more
important here, the syntax highlighting already is too complex.

Why not use a match to show whitespace?

-- 
Not too long ago, a program was something you watched on TV...

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

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

Raspunde prin e-mail lui