Skip to content

Commit

Permalink
fix(main): always return a main window, even when no main. Fixes #426
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed May 30, 2024
1 parent 1e09657 commit bda72a5
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lua/trouble/view/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ function M.get(main)
if not valid then
main = M._find()
end
-- Always return a main window even if it is not valid
main = main or M._info(vim.api.nvim_get_current_win())
-- update the cursor, unless the preview is showing in the main window
if main and not Preview.is_win(main.win) and vim.api.nvim_win_get_buf(main.win) == main.buf then
main.cursor = vim.api.nvim_win_get_cursor(main.win)
Expand Down

0 comments on commit bda72a5

Please sign in to comment.