Hi,
On Wed, Apr 19, 2017 at 4:25 AM, Daniel Hahler
<[email protected]> wrote:
> cgetexpr 'foo' produces a quickfix entry with valid = 1, but when using this
> entry again with setqflist is becomes valid = 0.
>
The setqflist() function sets the valid flag only for entries with a
valid file name and a line number. The other functions and commands that
populate the quickfix list do not apply this criteria. For these
commands/functions, as long as a quickfix errorformat pattern matches a
line, then the valid flag is set.
Changing this will break existing scripts (as can be seen from the failure
in the unit tests).
- Yegappan
>
> let &errorformat = '%m'
>
> cgetexpr 'foo'
>
> let expected = [{'lnum': 0, 'bufnr': 0, 'col': 0, 'valid': 1, 'vcol': 0,
> 'nr': -1, 'type': '', 'pattern': '', 'text': 'foo'}]
> AssertEqual getqflist(), expected
>
> call setqflist(expected)
> AssertEqual getqflist(), expected
>
> Related code:
> qf_parse_line:
> https://github.com/vim/vim/blob/fc8f1118e7ccd65b0537e47e6323c93a1df6a61a/src/quickfix.c#L842
> qf_add_entries:
> https://github.com/vim/vim/blob/fc8f1118e7ccd65b0537e47e6323c93a1df6a61a/src/quickfix.c#L4760-L4761
>
--
--
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.