Skip to content

Commit

Permalink
fix: jumplist picker resume after bwipeout (#2753)
Browse files Browse the repository at this point in the history
With this change we will check if the provided buffer number is valid,
before querying its `buftype` option. This is necessary, because
currently we would fail with:
```
Error executing vim.schedule lua callback:
...scope.nvim/lua/telescope/previewers/buffer_previewer.lua:473:
Invalid buffer id: X
```
error, if we try to resume a jumplist picker after doing `:bwipeout`.
  • Loading branch information
filakhtov committed Oct 23, 2023
1 parent 8c9fd22 commit 4522d7e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lua/telescope/previewers/buffer_previewer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,10 @@ previewers.vimgrep = defaulter(function(opts)

define_preview = function(self, entry)
-- builtin.buffers: bypass path validation for terminal buffers that don't have appropriate path
local has_buftype = entry.bufnr and vim.api.nvim_buf_get_option(entry.bufnr, "buftype") ~= "" or false
local has_buftype = entry.bufnr
and vim.api.nvim_buf_is_valid(entry.bufnr)
and vim.api.nvim_buf_get_option(entry.bufnr, "buftype") ~= ""
or false
local p
if not has_buftype then
p = from_entry.path(entry, true)
Expand Down

0 comments on commit 4522d7e

Please sign in to comment.