- Notifications
You must be signed in to change notification settings - Fork35
fix: restore proper window layout after diff operations#61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Open
alvarosevilla95 wants to merge3 commits intocoder:mainChoose a base branch fromalvarosevilla95:fix/diff-window-layout-restoration
base:main
Could not load branches
Branch not found:{{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline, and old review comments may become outdated.
Open
fix: restore proper window layout after diff operations#61
alvarosevilla95 wants to merge3 commits intocoder:mainfromalvarosevilla95:fix/diff-window-layout-restoration
Uh oh!
There was an error while loading.Please reload this page.
Conversation
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
Addresses window layout disruption after diff acceptance/rejection by:- Adding restore_window_layout() function in diff.lua- Detecting and properly sizing Claude terminal windows- Maintaining configured terminal width ratios- Adding get_config() method to terminal.lua for layout coordination- Applying restoration after diff resolve, cleanup, and deny operationsEnsures Claude terminal maintains its configured 30% width after diff operations.
Move restore_window_layout() function from diff.lua to terminal.luafor better code organization and separation of concerns.- Terminal module now handles all window layout management- Simplify diff.lua to delegate window restoration calls- Improve code maintainability and discoverability
51aa042
to8aef7be
CompareReplace manual window iteration with get_active_terminal_bufnr() methodfor cleaner and more efficient terminal window identification.
d07440f
to442c2ed
CompareSign up for freeto 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.
Uh oh!
There was an error while loading.Please reload this page.
Summary
Problem
When Claude creates diff views and the user accepts/rejects changes, the window layout becomes disrupted. The terminal window loses its configured proportions, making the interface less usable.
Solution
Core Fix:
restore_window_layout()
function to intelligently restore terminal window proportionsTechnical Implementation
Window Detection
snacks.nvim
and native terminal implementationsLayout Restoration Process
Integration Points
_resolve_diff_as_saved()
: Restore layout after user accepts changes_cleanup_diff_state()
: Restore layout during diff cleanupdeny_current_diff()
: Restore layout when user rejects changesFiles Changed
lua/claudecode/diff.lua
: Integrated window restoration calls, simplified to delegate to terminal modulelua/claudecode/terminal.lua
: Addedrestore_window_layout()
function andget_config()
method