mirror of
https://github.com/neovim/neovim.git
synced 2025-11-17 15:51:32 +00:00
fix(lsp): reuse_win prioritizes windows/tabs currently displayed #36486
Problem: reuse_win will always jump to the first window containing the target buffer rather even if the buffer is displayed in the current window/tab Solution: check to see if the buffer is already displayed in the current window or any window of the current buffer
This commit is contained in:
@@ -243,8 +243,9 @@ local function get_locations(method, opts)
|
||||
|
||||
vim.bo[b].buflisted = true
|
||||
local w = win
|
||||
if opts.reuse_win then
|
||||
w = vim.fn.win_findbuf(b)[1] or w
|
||||
if opts.reuse_win and api.nvim_win_get_buf(w) ~= b then
|
||||
w = vim.fn.bufwinid(b)
|
||||
w = w >= 0 and w or vim.fn.win_findbuf(b)[1] or win
|
||||
if w ~= win then
|
||||
api.nvim_set_current_win(w)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user