Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(preview): skip non-existing. Fixes #87. Fixes #188. Fixes #336. #338

Merged
merged 1 commit into from
Oct 8, 2023

Conversation

YodaEmbedding
Copy link
Contributor

@YodaEmbedding YodaEmbedding commented Oct 8, 2023

Continuation of 46b60e9.

Skip preview for non-existing buffer (bufnr == 0).

The vim docs say:

getqflist()

Quickfix list entries with a non-existing buffer
 number are returned with "bufnr" set to zero (Note: some
 functions accept buffer number zero for the alternate buffer,
 you may need to explicitly check for zero).

This causes trouble for the "Trouble" file section:

To fix, we simply do:

function View:_preview()
  ...

  if item.bufnr == 0 then
    return
  end

  util.debug("preview")
  ...
end

folke#336.

Skip preview for non-existing buffer (`bufnr == 0`).

The vim docs say:

```
getqflist()

Quickfix list entries with a non-existing buffer
 number are returned with "bufnr" set to zero (Note: some
 functions accept buffer number zero for the alternate buffer,
 you may need to explicitly check for zero).
```

This causes trouble for the "`Trouble`" file section:

![](https://user-images.githubusercontent.com/721196/260180476-286d5945-2f53-4f2c-aedc-af793c0e96db.png)

To fix, we simply do:

```lua
function View:_preview()
  ...

  if item.bufnr == 0 then
    return
  end

  util.debug("preview")
  ...
end
```
@folke folke merged commit 5e78824 into folke:main Oct 8, 2023
@folke
Copy link
Owner

folke commented Oct 8, 2023

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants