> > 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 think so because a match list is orderd by a priority not an ID.
However, if we really need to reduce a nested loop,
a simple idea is something like this:

    cur = wp->w_match_head;
    while (cur != NULL && cur->id != wp->w_next_match_id)
        cur = cur->next;
    if (cur == NULL)
        id = wp->w_next_match_id;
    else
        id = wp->w_manual_match_id_max + 1000;
    wp->w_next_match_id = id + 1
    
Once a overlap is found, intentionally assign max manual ID + 1000 as ID.
The ID can be overlapped later though.

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

OK, let me try later.

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