Skip to content

Commit

Permalink
fix(preview): properly load buffer when showing preview
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed Feb 16, 2023
1 parent 82c9a9a commit 949199a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lua/trouble/view.lua
Original file line number Diff line number Diff line change
Expand Up @@ -471,8 +471,8 @@ function View:_preview()
vim.api.nvim_buf_call(item.bufnr, function()
-- Center preview line on screen and open enough folds to show it
vim.cmd("norm! zz zv")
if vim.api.nvim_buf_get_option(item.bufnr, "filetype") == "" then
vim.cmd("do BufRead")
if not vim.api.nvim_buf_is_loaded(item.bufnr) then
vim.fn.bufload(item.bufnr)
end
end)

Expand Down

0 comments on commit 949199a

Please sign in to comment.