Rich Howe wrote:

> > > Note that, in this proposal, 
> > > w_next_match_id 
> > > w_manual_match_id_min 
> > > w_manual_match_id_max 
> > > are initialized in clear_matches() and 
> > > when the last id is deleted in match_delete(). 
> > > However, I am not sure why, w_next_match_id is not initialzed 
> > > in the latest verison. 
> > 
> > Just because it's not needed, since there was the loop to find an 
> > avaialble match ID. 
> > 
> > > Is it really necessary to remain those 3 variables even when all cleared? 
> > 
> > Nope. 
> 
> Ah, I remember that setmatches() internally calls clear_matches().
> If matchaddpos() is called without a manual ID after that,
> the loop to find an available ID starts from 4,
> which is likely to overlap several times and wastes time.
> It is better to remain w_next_match_id as same as currently.
> 
> This is my proposal of changes and updated 2 files.
> Please let me know any concerns.

I still see a nested while loop.  Is that readlly needed?

I suggest you write a test.  There already is some in
src/testdir/test_match.vim, but it would be good to test:
 - mix of matchaddpos() with manual and automatic ID
 - Then calling getmatches() and setmatches()
 - Then some more calls to matchaddpos() to check getting different IDs.


-- 
Facepalm statement #7: "Last week I almost got pregnant!"

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