On Mon, Sep 19, 2016 at 9:05 AM, Bram Moolenaar <
Br...@moolenaar.net> wrote:
>
> Brett Stahlman wrote:
>
>> The syntax documentation suggests that the 'keepend' argument applies
>> only to syntax regions, not syntax matches. But if I highlight a
>> buffer containing only the following line...
>>
>> ABCDE
>>
>> ...with the following syntax definitions...
>>
>> syn match A /A/
>> syn match Inside /[A-Z]\+/ transparent contained containedin=A
>> hi A guifg=blue
>>
>> ...the match group "A" extends (apparently incorrectly) from A through
>> E, though its pattern matches only the "A".
>
> This is correct, the inner match continues, causing the outer match not
> to end. :syn match does not have "keepend" but that doesn't mean it
> always keeps its end.
But syn-match *does* have 'keepend' - at least, it seems to be
respecting it (though as I mentioned, neither the docs nor the vim
syntax seem to think it should). Without 'keepend', group "A" extends
until "Inside" ends, at which point, "A" ends too. It's as though the
syntax engine knows A's pattern match has ended, but the presence of a
contained group is keeping the containing group active. I added
'keepend' because I wanted the end of "A" to determine the end of
"Inside", not the other way around, and the 'keepend' argument to
syn-match does indeed give the desired behavior. In fact, not having a
way to specify this behavior would be a real limitation if contained
groups can extend the containing syn-match group. Is :syn match's
current handling of 'keepend' not by design? I can fix the issue I was
having by using 'keepend', but don't want to do so if syn-match is
honoring 'keepend' only by accident...
Thanks,
Brett Stahlman