Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lua/codediff/ui/explorer/actions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ function M.navigate_next(explorer)

-- Update tree selection visually (switch to explorer window temporarily)
local current_win = vim.api.nvim_get_current_win()
if vim.api.nvim_win_is_valid(explorer.winid) then
if explorer.winid and vim.api.nvim_win_is_valid(explorer.winid) then
local line = find_node_line(explorer, next_file.data.path, next_file.data.group)
if line then
vim.api.nvim_set_current_win(explorer.winid)
Expand Down Expand Up @@ -114,7 +114,7 @@ function M.navigate_prev(explorer)

-- Update tree selection visually (switch to explorer window temporarily)
local current_win = vim.api.nvim_get_current_win()
if vim.api.nvim_win_is_valid(explorer.winid) then
if explorer.winid and vim.api.nvim_win_is_valid(explorer.winid) then
local line = find_node_line(explorer, prev_file.data.path, prev_file.data.group)
if line then
vim.api.nvim_set_current_win(explorer.winid)
Expand Down
10 changes: 10 additions & 0 deletions tests/e2e/explorer/actions_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,16 @@ for _, backend in ipairs({ "native", "polling" }) do
h.expect_text(screen, "modified", "working-A")
end)

it("[E21] file navigation works while an initially hidden panel has never been shown", function()
screen:exec("require('codediff').setup({ explorer = { hidden = true } })")
open("CodeDiff -- a.txt b.txt")
h.action(screen, "view", "next_file", "modified")
h.expect_text(screen, "modified", "working-B")
h.idle(screen)
h.action(screen, "view", "prev_file", "modified")
h.expect_text(screen, "original", "index-A")
end)

it("[E13] pathspecs and ignore filters continue to apply after external changes", function()
screen:exec("require('codediff').setup({ explorer = { file_filter = { ignore = { 'nested/**' } } } })")
open("CodeDiff -- a.txt nested/alpha.txt")
Expand Down