feat: toggle layout, welcome page improvements, stale buffer fixes#307
Merged
esmuellert merged 8 commits intomainfrom Mar 4, 2026
Merged
feat: toggle layout, welcome page improvements, stale buffer fixes#307esmuellert merged 8 commits intomainfrom
esmuellert merged 8 commits intomainfrom
Conversation
Add ability to toggle diff layout while a session is open. Uses the existing single_pane mechanism for A/D files and rerender_current() to replay the current file selection in the new layout. - toggle.lua: orchestrates layout switch (normalize windows, rerender) - explorer/history: rerender_current() + current_selection + opts.force - side_by_side/inline_view: layout identity guards, window validity guards - keymaps: fresh buffer refs at execution time (stale closure fix) - lifecycle: get_layout/update_layout accessors Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…sistency - Remove display_state, diff_config, and their helpers (set_display_state, copy_session_config, build_single_file_state) — toggle works purely through existing session fields + rerender_current() - Remove reset_diff_panes (dead code — unreachable fallback) - Rename show_placeholder → reset_diff_panes (removed) - Rename rerender_current_source → rerender_current_file - Remove show_single_file_preview (dead code, no callers) - Remove current_layout private wrapper (inlined) - Change default toggle keymap from gl to t - Fix toggle rollback: always commit layout change, no desync Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The toggle refactoring accidentally removed the eager require for codediff.ui.welcome at the top of refresh.lua, causing welcome page to never show (nil reference error on every refresh cycle). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The selected_path/selected_group closure variables in explorer render.lua persisted after welcome page was shown, causing stale highlight on matching file entries. Added clear_selection() method on explorer object, called from clear_current_file() in refresh. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- README: add toggle_layout = 't' to keymaps config, add toggle feature to features list - vimdoc: add codediff-toggle-layout section, add toggle_layout to keymaps config example - tags: regenerated Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- macOS: resolve symlinks in path comparison (/var vs /private/var) - Windows: use double quotes in all git commit messages (single quotes are literal on cmd.exe) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
d96e9bc to
8a6eb94
Compare
Root cause: vim.fn.system (synchronous) called inside vim.wait's condition function blocks the event loop, preventing vim.system's async callbacks from completing. On Windows where git is slower, the async chain (git apply → callback → refresh → status → render) never finishes. Fix: use pure event-loop spin (vim.wait with return false) for all hunk operation tests (stage, unstage, discard) to let the full async chain complete without blocking. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Toggle between inline and side-by-side layout (
tkey)Press
tin any diff view to toggle between side-by-side and inline layout. The current file is re-rendered in the new layout automatically. Works in explorer, history, and standalone modes.toggle.lua: Orchestrates layout switch (normalize windows → rerender current file)single_panemechanism andrerender_current()to replay file selectionkeymaps.view.toggle_layout = "t"Closes #292
Closes #302
Closes the runtime toggle aspect of #146.
Welcome page improvements
welcomemodule require (regression from toggle refactoring)Stale buffer fix improvements
Code cleanup
display_state/diff_configabstractions (toggle works purely through existing session fields)reset_diff_panes,show_single_file_preview,current_layoutwrapperrerender_current_source→rerender_current_fileDocumentation
codediff-toggle-layoutsectionTesting
layout_toggle_spec.lua)