Am 2014-08-14 01:30, schrieb Bram Moolenaar:
Christian Brabandt wrote:

Hi Bram!

On Mi, 13 Aug 2014, Bram Moolenaar wrote:

>
> Christian Brabandt wrote:
>
> > > > On Sa, 09 Aug 2014, Bram Moolenaar wrote:
> > > > > David Barnett wrote:
> > > > >
> > > > > > Looks like it's patch 7.4.362:
> > > > > >
> > > > > > Problem:    When matchaddpos() uses a length smaller than the 
number of
> > > > > > bytes
> > > > > >     in the (last) character the highlight continues until the end of
> > > > > >     the line.
> > > > > > Solution:   Change condition from equal to larger-or-equal.
> > > > > > Files:     src/screen.c
> > > > > >
> > > > > >
> > > > > > It's a very small change but apparently problematic. Can it be 
reverted or
> > > > > > rethought?
> > > > >
> > > > > I'm glad you could pinpoint it.  I assumed that when the condition
> > > > > evaluates to true the match information would be updated.  But perhaps
> > > > > that doesn't happen in this case and it searches for a match every 
time.
> > > > >
> > > > > Needs some debugging to figure out what happens.  What matches does 
this
> > > > > plugin add when it's slow?
> > > >
> > > > Perhaps it is better to revert that patch and make sure, highlighting
> > > > gets only applied, if there is a match at the actual position?
> > > >
> > > > diff --git a/src/screen.c b/src/screen.c
> > [...]
> > >
> > > I haven't tried it, but it looks like this only avoids highlighting
> > > positions after the endcol when "v" and shl->endcol aren't exactly the
> > > same (which can happen for multi-byte characters), but it doesn't update
> > > the state, thus a next match might be missed.
> >
> > Yes, that is what patch 7.3.362 tried to fix, isn't it?
>
> So your patch doesn't work.  Try this:
>
>    highlight MyGroup ctermbg=green guibg=green
>    let m = matchaddpos("MyGroup", [[4, 24, 2], [4, 30, 2]])
>
>    " asdfasdfasdfasdfasdfas℅fasdfasdfasdfasdf
>
> Before pach 362 it would highlight everything from column 24.
> After the fix it looks OK, but we get complaints about slowness.
> After your fix only the first match shows up.

I don't see that here (screenshot attached)

Did you put a multi-byte character at the end of the first match?

Ah, now I can reproduce it.

But anyway, this raises the question again, why matchaddpos() accepts a list of positions (but only 8 items), while all other functions usually
only accept 1 position.

It's used for the matchparen plugin.  The idea is that it's useful for
other plugins as well.

Yes, but for consistency with the other match() functions and the VimL API
it might still be a good idea to only accept a single position per
matchaddpos() call. It shouldn't be too hard, to adjust the matchparen plugin
to call matchaddpos() twice, right?

Best,
Christian

--
--
You received this message from the "vim_use" 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_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to