Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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:main
base:main
Choose a base branch
Loading
fromalvarosevilla95:fix/diff-window-layout-restoration

Conversation

alvarosevilla95
Copy link

@alvarosevilla95alvarosevilla95 commentedJun 22, 2025
edited
Loading

Summary

  • Fixes window layout disruption after diff operations complete
  • Ensures Claude's terminal maintains proper width ratios (30% default) after diffs

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:

  • Addedrestore_window_layout() function to intelligently restore terminal window proportions
  • Integrated restoration at all diff completion points (accept, reject, cleanup)
  • Maintains proper terminal width ratios based on user configuration

Technical Implementation

Window Detection

  • Handles bothsnacks.nvim and native terminal implementations
  • Graceful fallback when terminal windows aren't found

Layout Restoration Process

  1. Find the Claude terminal window among all open windows
  2. Calculate proper terminal width based on user configuration (default 30%)
  3. Apply width settings with window equalization
  4. Re-enforce terminal proportions to prevent drift

Integration Points

  • _resolve_diff_as_saved(): Restore layout after user accepts changes
  • _cleanup_diff_state(): Restore layout during diff cleanup
  • deny_current_diff(): Restore layout when user rejects changes

Files Changed

  • lua/claudecode/diff.lua: Integrated window restoration calls, simplified to delegate to terminal module
  • lua/claudecode/terminal.lua: Addedrestore_window_layout() function andget_config() method

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
@alvarosevilla95alvarosevilla95force-pushed thefix/diff-window-layout-restoration branch from51aa042 to8aef7beCompareJune 22, 2025 21:06
Replace manual window iteration with get_active_terminal_bufnr() methodfor cleaner and more efficient terminal window identification.
@alvarosevilla95alvarosevilla95force-pushed thefix/diff-window-layout-restoration branch fromd07440f to442c2edCompareJune 22, 2025 21:18
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

1 participant
@alvarosevilla95

[8]ページ先頭

©2009-2025 Movatter.jp