feat(panel): support auto-fitting panel width to content#42
Merged
dlyongemallo merged 1 commit intomainfrom Mar 15, 2026
Merged
feat(panel): support auto-fitting panel width to content#42dlyongemallo merged 1 commit intomainfrom
dlyongemallo merged 1 commit intomainfrom
Conversation
There was a problem hiding this comment.
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
Panelsplit config validation to acceptwidth = "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.
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.
3da55e6 to
55716d8
Compare
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.
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.