fix: restore proper window layout after diff operations#61
fix: restore proper window layout after diff operations#61alvarosevilla95 wants to merge 1 commit into
Conversation
d07440f to
442c2ed
Compare
|
Hey @alvarosevilla95, thanks for this PR. Could you provide me with steps to reproduce this scrambled layout? |
|
@ThomasK33 At least for me, this happens when you have Claude propose a diff and you accept / reject it. So:
Screen.Recording.2025-07-31.at.12.42.41.movWith this change, after the diff split closes claude preserves its original width. |
7bcc421 to
ba93a3a
Compare
|
Gotcha, thanks for the video. I don't have those issues in my setup, though. Could you push a minimal fixture that reproduces that bug? This would serve as a reproduction for me locally and validate that this fixes the issue itself. |
ah interesting, need to see what is it on my setup that is triggering it then.. i'll look into it and update / add a fixture accordingly 👍 |
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.nvimand 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