Skip to content

Commit 4522d7e

Browse files
fix: jumplist picker resume after bwipeout (#2753)
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`.
1 parent 8c9fd22 commit 4522d7e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lua/telescope/previewers/buffer_previewer.lua

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,10 @@ previewers.vimgrep = defaulter(function(opts)
563563

564564
define_preview = function(self, entry)
565565
-- builtin.buffers: bypass path validation for terminal buffers that don't have appropriate path
566-
local has_buftype = entry.bufnr and vim.api.nvim_buf_get_option(entry.bufnr, "buftype") ~= "" or false
566+
local has_buftype = entry.bufnr
567+
and vim.api.nvim_buf_is_valid(entry.bufnr)
568+
and vim.api.nvim_buf_get_option(entry.bufnr, "buftype") ~= ""
569+
or false
567570
local p
568571
if not has_buftype then
569572
p = from_entry.path(entry, true)

0 commit comments

Comments
 (0)