Ben Fritz wrote:
> I use the standard C syntax rules, but I have added a couple of rules
> in my after/syntax/c.vim file to add some additional syntax folding. I
> have narrowed my problem down to the following addition:
> 
> " add folding of multiline () groups
> syn region SynFoldParen
>       \ start="(" end=")"
>       \ skip=+"\%(\\"\|[^"]\)\{-}\\\@<!"\|'[^']\{-}'\|'\\''\|//.*+
>       \ transparent fold keepend extend
>       \ containedin=ALLBUT,cComment,cCommentL,cString,cCppString
> 
> Using this addition, with this code::
> 
> void foo()
> {
>   printf("look how {braces} break highlighting!\n");
> }
> 
> makes the "Constant" highlighting go away after the closing brace
> ('}') in the printf statement.

Where is the 'Constant' highlighting meant to be? I don't get it. Is it
a custom syntax rule too? Or maybe some setting in your vimrc enables
it? Perhaps check your syntax/c.vim is up to date, and send us your
custom file to see if we can reproduce it? Also quote your Vim version,
perhaps, in case it's relevant.

Ben.

> Without the additional fold rule, the highlighting is fine.
> 
> I have the following mapping to display the current syntax stack:
> 
>   nmap <F10>
>         \ :echo '<'.synIDattr(synIDtrans(synID(line('.'),col('.'),
> 1)),'name').'> from:' <bar>
>         \ let indent = '' <bar>
>         \ for syn_id in synstack(line('.'), col('.')) <bar>
>         \   echo indent.'<'.synIDattr(syn_id,"name").'>' <bar>
>         \   let indent .= ' ' <bar>
>         \ endfor <bar>
>         \ unlet indent<CR>
> 
> Using this command, I get for the syntax stack, between the opening
> double-quote and the closing brace:
> 
> <Constant> from:
> <cBlock>
>  <SynFoldParen>
>   <cParen>
>    <cString>
> 
> After the closing brace until the end quote, I get:
> 
> <> from:
> <cBlock>
>  <SynFoldParen>
>   <cParen>
>    <cString>
> 
> Even the \n gets the correct "cSpecial" highlight group:
> 
> <> from:
> <cBlock>
>  <SynFoldParen>
>   <cParen>
>    <cString>
>     <cSpecial>
> 
> Everything seems correct in these last two syntax stacks, except that
> highlight group that is linked to the final item in the syntax stack
> does not get applied. I'm completely baffled as to why.
> 
> I thought at first that maybe the cBlock group from the function body
> was ending prematurely, but this is not the case, as I can see from
> the fold column (since cBlock is folded).
> 
> Syntax stacks for the places above using just the standard rules are
> identical, except for the fact that SynFoldParen is missing, and the
> correct linked highlight group is applied.
> > 
> 

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

Reply via email to