Skip to content

Commit 16b6ba0

Browse files
authored
fix(ghost_text): validate buffer before redraw to prevent errors (#2050)
Closes #1764
1 parent d73dfcb commit 16b6ba0

File tree

1 file changed

+4
-1
lines changed
  • lua/blink/cmp/completion/windows/ghost_text

1 file changed

+4
-1
lines changed

lua/blink/cmp/completion/windows/ghost_text/utils.lua

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ function utils.is_noice()
1212
end
1313

1414
function utils.redraw_if_needed()
15-
if utils.is_cmdline() then vim.api.nvim__redraw({ buf = utils.get_buf(), flush = true }) end
15+
if utils.is_cmdline() then
16+
local bufnr = utils.get_buf() or 0
17+
if vim.api.nvim_buf_is_valid(bufnr) then vim.api.nvim__redraw({ buf = utils.get_buf(), flush = true }) end
18+
end
1619
end
1720

1821
--- Gets the buffer to use for ghost text

0 commit comments

Comments
 (0)