Skip to content

Commit 3ec1ffb

Browse files
committed
fix(win): split=enew from scratch buffer + jump1
1 parent 5b50a2b commit 3ec1ffb

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

lua/fzf-lua/win.lua

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1258,7 +1258,10 @@ function FzfWin:close(fzf_bufnr, hide, hidden)
12581258
-- "split" reused the current win (e.g. "enew")
12591259
-- restore the original buffer and styling options
12601260
self:set_winopts(self.fzf_winid, self.src_winid_style or {})
1261-
utils.win_set_buf_noautocmd(self.fzf_winid, self.src_bufnr)
1261+
-- buf may be invalid if we switched away from a scratch buffer
1262+
if vim.api.nvim_buf_is_valid(self.src_bufnr) then
1263+
utils.win_set_buf_noautocmd(self.fzf_winid, self.src_bufnr)
1264+
end
12621265
-- also restore the original alternate buffer
12631266
local alt_bname = (function()
12641267
local alt_bufnr = utils.__CTX() and utils.__CTX().alt_bufnr

0 commit comments

Comments
 (0)