diff options
| author | Nicknamess96 <113626193+Nicknamess96@users.noreply.github.com> | 2026-02-28 15:59:53 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-02-28 09:59:53 -0500 |
| commit | c1e60f36f3fb915bb59503dedd330addb63161ac (patch) | |
| tree | 58a39ab8b5ff23e4296dc2601dfb66e7e2df6211 /runtime/pack | |
| parent | 32e0d05d53f452a445afad161f6dda31ac054484 (diff) | |
fix(difftool): don't reset quickfix list when closing quickfix window #38088
Closing the quickfix window previously triggered a WinClosed autocmd
that deleted all difftool autocmds and pushed an empty quickfix list,
making the difftool non-functional. Users who close the quickfix window
to gain screen real estate for viewing diffs had no way to continue
navigating entries.
Remove the qf_win tracking and its associated WinClosed autocmd so that
closing the quickfix window no longer tears down the difftool state.
Closing either diff window still performs full cleanup as before.
The BufWinEnter handler no longer passes with_qf to diff_files, so
navigating entries while the quickfix window is closed reuses the
existing diff layout without forcing a layout rebuild.
Fixes #37388
Diffstat (limited to 'runtime/pack')
| -rw-r--r-- | runtime/pack/dist/opt/nvim.difftool/lua/difftool.lua | 24 |
1 files changed, 2 insertions, 22 deletions
diff --git a/runtime/pack/dist/opt/nvim.difftool/lua/difftool.lua b/runtime/pack/dist/opt/nvim.difftool/lua/difftool.lua index b40517e4f1..2e4562a6c5 100644 --- a/runtime/pack/dist/opt/nvim.difftool/lua/difftool.lua +++ b/runtime/pack/dist/opt/nvim.difftool/lua/difftool.lua @@ -28,7 +28,6 @@ local layout = { group = nil, left_win = nil, right_win = nil, - qf_win = nil, } local util = require('vim._core.util') @@ -42,7 +41,6 @@ local function cleanup_layout(with_qf) end layout.left_win = nil layout.right_win = nil - layout.qf_win = nil if with_qf then vim.fn.setqflist({}) @@ -55,9 +53,8 @@ end local function setup_layout(with_qf) local left_valid = layout.left_win and vim.api.nvim_win_is_valid(layout.left_win) local right_valid = layout.right_win and vim.api.nvim_win_is_valid(layout.right_win) - local qf_valid = layout.qf_win and vim.api.nvim_win_is_valid(layout.qf_win) - if left_valid and right_valid and (not with_qf or qf_valid) then + if left_valid and right_valid then return false end @@ -68,9 +65,6 @@ local function setup_layout(with_qf) if with_qf then vim.cmd('botright copen') - layout.qf_win = vim.api.nvim_get_current_win() - else - layout.qf_win = nil end vim.api.nvim_set_current_win(layout.right_win) @@ -89,20 +83,6 @@ local function setup_layout(with_qf) cleanup_layout(with_qf) end, }) - if with_qf then - vim.api.nvim_create_autocmd('WinClosed', { - group = layout.group, - pattern = tostring(layout.qf_win), - callback = function() - -- For quickfix also close one of diff windows - if layout.left_win and vim.api.nvim_win_is_valid(layout.left_win) then - vim.api.nvim_win_close(layout.left_win, true) - end - - cleanup_layout(with_qf) - end, - }) - end end --- Diff two files @@ -497,7 +477,7 @@ function M.open(left, right, opt) vim.w.lazyredraw = true vim.schedule(function() - diff_files(entry.user_data.left, entry.user_data.right, true) + diff_files(entry.user_data.left, entry.user_data.right) vim.w.lazyredraw = false end) end, |
