On Monday, April 18, 2016 at 9:39:15 AM UTC+3, Bram Moolenaar wrote:
> Yegappan Lakshmanan wrote:
> 
> > On Sun, Apr 17, 2016 at 11:38 AM, Yegappan Lakshmanan
> > <[email protected]> wrote:
> > > Hi,
> > >
> > > On Sun, Apr 17, 2016 at 3:35 AM, Ramel Eshed <[email protected]> wrote:
> > >> On Sunday, April 17, 2016 at 3:12:55 AM UTC+3, [email protected] wrote:
> > >>> Hi,
> > >>>
> > >>> On Sat, Apr 16, 2016 at 3:43 PM, Yegappan Lakshmanan
> > >>> <[email protected]> wrote:
> > >>> > Hi,
> > >>> >
> > >>> > On Sat, Apr 16, 2016 at 12:52 PM, Ramel Eshed <[email protected]> wro=
> > te:
> > >>> >> Adding an item to the current quickfix list causes a jump to the fir=
> > st item rather than keeping the current context:
> > >>> >>
> > >>> >> Download the attached file;
> > >>> >> vim -u NONE -N
> > >>> >> :source qf_test.vim
> > >>> >>
> > >>> >> -After adding 2 items, :cn, adding one more item and another :cn we =
> > are in (2 of 3) instead of (3 of 3).
> > >>> >>
> > >>> >
> > >>> > The setqflist() function resets the index of the quickfix list so tha=
> > t it
> > >>> > points to the first entry (even if entries are appended to the list).
> > >>> >
> > >>> > Due to a bug in the set_errorlist() function, the index is set to 1 i=
> > nstead
> > >>> > of zero. That is why, you saw 2 of 3 instead of 1 of 3.
> > >>> >
> > >>>
> > >>> The quickfix index is 1 based and not zero based. The current code corr=
> > ectly
> > >>> sets the index to 1. So there is no bug in the current code.
> > >>>
> > >>> The documentation for the setqflist() function needs to be updated to
> > >>> state that it will reset to the first valid entry.
> > >>>
> > >>> - Yegappan
> > >>
> > >> Is there any reason to reset the pointer each time? I think that it is
> > >> more reasonable to leave the pointer as it when adding to the list so
> > >> it=E2=80=99d be possible to work with the list and adding new items to i=
> > t when
> > >> they=E2=80=99re available without losing the context.
> > >>
> > >
> > > Agreed. I will send out a patch later today for this.
> > 
> > A patch with tests is attached.
> 
> Thanks!
> 
> -- 
> I'd like to meet the man who invented sex and see what he's working on now.
> 
>  /// 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    ///

Thanks for the patch, it solved the issues I had.

I wrote a simple async grep plugin and I'm able to update the quickfix list on 
the fly now, but I ran into some performance issues which are probably caused 
by the internal quickfix implementation. I'll try to elaborate more on this 
tomorrow.

Ramel

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