navigation-file: fix empty buffer

This commit is contained in:
Tomas Mirchev 2025-10-15 22:21:15 +03:00
parent 7c9246ab08
commit 9b8bd80cde

View File

@ -25,6 +25,16 @@ local function open_float(prompt)
local input_buf = vim.api.nvim_create_buf(false, true) local input_buf = vim.api.nvim_create_buf(false, true)
local result_buf = vim.api.nvim_create_buf(false, true) local result_buf = vim.api.nvim_create_buf(false, true)
-- 🧩 Mark both buffers as temporary
for _, b in ipairs({ input_buf, result_buf }) do
vim.bo[b].bufhidden = 'wipe'
vim.bo[b].buflisted = false
vim.bo[b].swapfile = false
end
vim.bo[input_buf].buftype = 'prompt'
vim.bo[result_buf].buftype = 'nofile'
local width = math.floor(vim.o.columns * 0.7) local width = math.floor(vim.o.columns * 0.7)
local height = 20 local height = 20
local row = math.floor((vim.o.lines - height) / 2) local row = math.floor((vim.o.lines - height) / 2)
@ -39,7 +49,6 @@ local function open_float(prompt)
style = 'minimal', style = 'minimal',
border = 'rounded', border = 'rounded',
}) })
vim.api.nvim_buf_set_option(input_buf, 'buftype', 'prompt')
vim.fn.prompt_setprompt(input_buf, prompt) vim.fn.prompt_setprompt(input_buf, prompt)
local result_win = vim.api.nvim_open_win(result_buf, false, { local result_win = vim.api.nvim_open_win(result_buf, false, {