Skip to content

Commit

Permalink
fix(preview): clear highlights of preview buffer
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed May 30, 2024
1 parent d9542ca commit d590491
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 0 additions & 2 deletions lua/trouble/config/actions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ local M = {
self:close()
end,
cancel = function(self)
local Preview = require("trouble.view.preview")
Preview.close()
self:goto_main()
end,
preview = function(self, ctx)
Expand Down
3 changes: 2 additions & 1 deletion lua/trouble/view/preview.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ M.preview = nil ---@type {win:number,buf:number,view:table}?

function M.close()
local preview = M.preview
M.preview = nil
if not (preview and vim.api.nvim_buf_is_valid(preview.buf)) then
return
end
M.preview = nil
Render.reset(preview.buf)
if vim.api.nvim_win_is_valid(preview.win) then
Render.reset(vim.api.nvim_win_get_buf(preview.win))
Util.noautocmd(function()
vim.api.nvim_win_set_buf(preview.win, preview.buf)
vim.api.nvim_win_call(preview.win, function()
Expand Down

0 comments on commit d590491

Please sign in to comment.