Christian Brabandt wrote:

> Recently, I wondered how to clear the quickfix list (and location list).
> My first try was to use setqflist() with an empty list. While this did
> result in an empty quickfix list, it did not make :cw work as it was
> supposed to be. I am not sure whether I am supposed to clear the
> quickfix list like that, but I didn't expect, that this is not possible
> using setqflist(). 
> Then I found out that using :cgetexpr [] really clears the quickfix list 
> and makes :cw work as expected. 
> 
> So here is a patch, that makes setqflist([]) behave as I would have
> expected it. Admittedly this is a minor inconsistency, but when skimming
> through the help, I did not easily find a way to clear the list, so I
> thought this might be useful.
> 
> chrisbra t41:~/vim/src [1019]% hg diff quickfix.c ../runtime/doc/eval.txt
> diff -r 24100651daa9 runtime/doc/eval.txt
> --- a/runtime/doc/eval.txt      Tue Mar 23 18:22:46 2010 +0100
> +++ b/runtime/doc/eval.txt      Mon Apr 26 22:39:24 2010 +0200
> @@ -4944,6 +4944,8 @@
>                 item will not be handled as an error line.
>                 If both "pattern" and "lnum" are present then "pattern" will
>                 be used.
> +               If you supply an empty {list}, the quickfix list will be
> +               cleared.
>                 Note that the list is not exactly the same as what
>                 |getqflist()| returns.
> 
> diff -r 24100651daa9 src/quickfix.c
> --- a/src/quickfix.c    Tue Mar 23 18:22:46 2010 +0100
> +++ b/src/quickfix.c    Mon Apr 26 22:39:24 2010 +0200
> @@ -3654,7 +3654,10 @@
>         }
>      }
> 
> -    qi->qf_lists[qi->qf_curlist].qf_nonevalid = FALSE;
> +    if (qi->qf_lists[qi->qf_curlist].qf_index == 0)
> +       qi->qf_lists[qi->qf_curlist].qf_nonevalid = TRUE;
> +    else
> +       qi->qf_lists[qi->qf_curlist].qf_nonevalid = FALSE;
>      qi->qf_lists[qi->qf_curlist].qf_ptr = 
> qi->qf_lists[qi->qf_curlist].qf_start;
>      qi->qf_lists[qi->qf_curlist].qf_index = 1;

Makes sense.  I'll have a closer look later.

-- 
How To Keep A Healthy Level Of Insanity:
16. Have your coworkers address you by your wrestling name, Rock Hard Kim.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.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

Raspunde prin e-mail lui