Skip to content

feat: welcome page + fix stale diff panes after git operations#305

Merged
esmuellert merged 8 commits intomainfrom
dev
Mar 4, 2026
Merged

feat: welcome page + fix stale diff panes after git operations#305
esmuellert merged 8 commits intomainfrom
dev

Conversation

@esmuellert
Copy link
Owner

Summary

Two major improvements to the explorer mode:

1. Welcome page when changes are resolved

When all changes disappear (staged/committed/stashed) while the explorer is open, a centered CodeDiff logo with hint text replaces the stale diff content. Uses the same single_pane mechanism as A/D files.

  • welcome.lua: Pure buffer factory — creates centered logo buffer
  • welcome_window.lua: Manages window options (hides line numbers/gutter for clean display, restores on leave)
  • side_by_side.lua + inline_view.lua: show_welcome() wrappers using existing single-file mechanism

2. Fix stale diff panes after git operations

Root cause: process_result() in refresh.lua rebuilt the explorer tree correctly but never called on_file_select to update the diff panes. The old restore selection block searched group nodes (not file children) and used a no-op set_node().

Fix: After refresh, search status_result for the currently viewed file (same group first, then all groups). If found, call on_file_select to update diff panes. If not found, show welcome page.

Scenarios fixed (all verified via E2E tests):

  • Stage file → diff updates to staged comparison ✅
  • Unstage file → diff updates to unstaged comparison ✅
  • File in both groups, re-stage → follows to new group ✅
  • Commit file (others remain) → shows welcome ✅
  • Commit/stash everything → shows welcome ✅

3. Resilience improvements

  • core.lua: pcall for move module, only when moves exist
  • keymaps.lua: pcall inside callback so keymap always registers

Testing

  • 7 new stale buffer E2E tests with real git repos
  • 7 welcome page tests (unit + E2E)
  • All existing tests pass

@esmuellert esmuellert enabled auto-merge March 4, 2026 04:27
esmuellert and others added 6 commits March 3, 2026 23:28
Show a centered CodeDiff logo with hint text when the explorer
refreshes and finds 0 files (all changes staged/committed/stashed).
Uses the same single_pane mechanism as A/D files in side-by-side
mode, and buffer swap in inline mode.

- welcome.lua: pure buffer factory (create_buffer, is_welcome_buffer)
- side_by_side.lua: show_welcome via existing show_single_file
- inline_view.lua: show_welcome via buffer swap (no window changes)
- refresh.lua: hook on 0 files, routes by layout mode
- welcome_spec.lua: unit tests + E2E test with real git repo

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
After git operations, the explorer tree refreshed correctly but diff
panes showed stale content because on_file_select was never called.

Root cause: process_result() in refresh.lua had a broken 'restore
selection' block — it searched group nodes (not file children) and
used a no-op set_node() call. Diff panes were never updated.

Fix: After refresh, search status_result for the currently viewed
file (same group first, then all groups). If found, call
on_file_select to update diff panes with correct revisions. If not
found (committed/removed), show welcome page.

Also added pcall guards for optional module loads (move rendering,
keymap help) to prevent cascade failures in headless test env.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
esmuellert and others added 2 commits March 3, 2026 23:48
Replace raw vim.fn.system('git -C ...') calls with repo.git() and
helpers.git_cmd() across all test files. Fixes Windows CI failures
caused by vim.fn.shellescape() using single quotes incompatible
with cmd.exe, and single-quoted commit messages.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Single-quoted commit messages in stale_buffer_spec.lua fail on
Windows cmd.exe where single quotes are literal characters.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@esmuellert esmuellert merged commit 00649b3 into main Mar 4, 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