fix: cursor sometimes disappears after making changes (#438)

This commit is contained in:
Steven Arcangeli 2024-07-03 18:14:52 -07:00
parent b15e4c1e64
commit b5a1abfde0
2 changed files with 16 additions and 7 deletions

View file

@ -114,10 +114,7 @@ M.show = vim.schedule_wrap(function(actions, should_confirm, cb)
render_lines(winid, bufnr, lines)
-- Disable cursor
-- We are in the preview window now, so no need to use autocmd with WinEnter
vim.api.nvim_set_hl(0, "OilPreviewCursor", { nocombine = true, blend = 100 })
vim.opt.guicursor:append("a:OilPreviewCursor/OilPreviewCursor")
local restore_cursor = util.hide_cursor()
-- Attach autocmds and keymaps
local cancel
@ -132,9 +129,7 @@ M.show = vim.schedule_wrap(function(actions, should_confirm, cb)
end
autocmds = {}
vim.api.nvim_win_close(winid, true)
-- restore cursor
vim.api.nvim_set_hl(0, "OilPreviewCursor", {})
vim.opt.guicursor:remove("a:OilPreviewCursor/OilPreviewCursor")
restore_cursor()
cb(value)
end
end