Skip to content

feat(panel): support auto-fitting panel width to content#42

Merged
dlyongemallo merged 1 commit intomainfrom
autosize_file_panel
Mar 15, 2026
Merged

feat(panel): support auto-fitting panel width to content#42
dlyongemallo merged 1 commit intomainfrom
autosize_file_panel

Conversation

@dlyongemallo
Copy link
Copy Markdown
Owner

Allow win_config.width = "auto" so the file panel (and file history panel) dynamically sizes itself to fit all displayed content instead of using a fixed column count.

Copilot AI review requested due to automatic review settings March 15, 2026 15:02
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for win_config.width = "auto" so split-based panels (notably the file panel and file history panel) can dynamically size their width to the rendered buffer content.

Changes:

  • Extend Panel split config validation to accept width = "auto" and implement auto-width computation based on rendered buffer line widths.
  • Trigger resizing after applying window-local options on open, and after rendering on redraw.
  • Document the new "auto" option in defaults/docs/README and add functional tests around config validation and width computation.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
lua/diffview/ui/panel.lua Implements "auto" width validation, content-width computation, and resize behavior changes.
lua/diffview/tests/functional/panel_spec.lua Adds tests for accepting/rejecting width values and for content-width calculation.
doc/diffview_defaults.txt Mentions "auto" as an option for the default file panel width setting.
doc/diffview.txt Documents {width} as `(integer
README.md Notes "auto" usage in the setup example comment.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lua/diffview/ui/panel.lua
Comment thread lua/diffview/ui/panel.lua
Comment thread lua/diffview/ui/panel.lua
Comment thread lua/diffview/ui/panel.lua
Comment thread lua/diffview/tests/functional/panel_spec.lua
Allow `win_config.width = "auto"` so the file panel (and file history
panel) dynamically sizes itself to fit all displayed content instead of
using a fixed column count.
@dlyongemallo dlyongemallo merged commit 80bbf36 into main Mar 15, 2026
2 checks passed
@dlyongemallo dlyongemallo deleted the autosize_file_panel branch March 15, 2026 15:15
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.

2 participants