Skip to content

fix: buffer matching, cross-tab refresh, staged rename flicker#308

Merged
esmuellert merged 3 commits intomainfrom
dev
Mar 5, 2026
Merged

fix: buffer matching, cross-tab refresh, staged rename flicker#308
esmuellert merged 3 commits intomainfrom
dev

Conversation

@esmuellert
Copy link
Owner

Summary

Three targeted bug fixes from dev branch.

Changes

fix(helpers): use exact buffer name matching in prepare_buffer

vim.fn.bufnr() uses pattern/prefix matching, causing collisions when one filename is a prefix of another (e.g. Makefile matching Makefile.win). This caused the left diff pane to show stale content when navigating between such files. Replaced with exact nvim_buf_get_name() comparison.

fix(refresh): show welcome after cross-tab commit

Git watcher discarded fs_event callbacks when the codediff tab wasn't active. If the user committed from another tab, the event was lost and diff panes stayed stale on return. Added _pending_refresh flag and TabEnter autocmd to flush pending refreshes.

fix(render): prevent diff flicker for staged renames

The same-file check in on_file_select failed for staged renames because session.modified_path is relative while abs_path is absolute. Each explorer refresh re-triggered view.update(), causing visible flicker. Added session.modified_path == file_path to the check.

Testing

  • All existing plenary tests pass
  • E2E validated with headless neovim scenarios
  • Tested against real repos with prefix-colliding filenames

esmuellert and others added 3 commits March 4, 2026 22:12
Git watcher discarded fs_event callbacks when the codediff tab
wasn't active. If the user committed from another tab, the event
was lost and diff panes stayed stale on return.

Set _pending_refresh flag when events fire on wrong tabpage and
add TabEnter autocmd to flush pending refreshes when the user
returns to the codediff tab.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
vim.fn.bufnr() uses pattern/prefix matching, causing collisions
when one filename is a prefix of another (e.g. Makefile matching
Makefile.win). This caused the left diff pane to show stale content
when navigating between such files.

Replace with exact nvim_buf_get_name() comparison to ensure the
correct buffer is returned.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The same-file check in on_file_select failed for staged renames
because session.modified_path is relative while abs_path is
absolute. Each explorer refresh re-triggered view.update(),
causing visible flicker.

Add session.modified_path == file_path to the check to handle
staged files where paths are stored as relative.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@esmuellert esmuellert enabled auto-merge March 5, 2026 06:50
@esmuellert esmuellert merged commit e41d133 into main Mar 5, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant