Skip to content

fix(panel): restrict auto-sizing to file tree content only#43

Merged
dlyongemallo merged 1 commit intomainfrom
tweak_panel_autosize
Mar 16, 2026
Merged

fix(panel): restrict auto-sizing to file tree content only#43
dlyongemallo merged 1 commit intomainfrom
tweak_panel_autosize

Conversation

@dlyongemallo
Copy link
Copy Markdown
Owner

No description provided.

Copilot AI review requested due to automatic review settings March 16, 2026 10:01
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

Adjusts Diffview panel auto-sizing so the computed width is driven by file-tree/log content rather than long header lines, and ensures headers are re-truncated after resizing.

Changes:

  • Re-render after applying auto-width so header lines truncate to the final window width.
  • Add Panel:get_autosize_components() and update compute_content_width() to optionally measure only specified component line ranges.
  • Update Diff/FileHistory panels to restrict autosize measurement to their main content components, and add functional tests for the new behavior.

Reviewed changes

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

Show a summary per file
File Description
lua/diffview/ui/panel.lua Adds autosize component hook, restricts width measurement, and re-renders after auto-resize.
lua/diffview/tests/functional/panel_spec.lua Adds tests for infer_width open/closed behavior and autosize-component measurement.
lua/diffview/scene/views/file_history/render.lua Computes root path per-render so truncation reflects current panel width.
lua/diffview/scene/views/file_history/file_history_panel.lua Restricts autosize measurement to log component.
lua/diffview/scene/views/diff/render.lua Truncates revision pretty name while keeping hash prefix visible.
lua/diffview/scene/views/diff/file_panel.lua Restricts autosize measurement to file list section components.

💡 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/scene/views/diff/file_panel.lua
Comment thread lua/diffview/scene/views/diff/render.lua
Comment thread lua/diffview/scene/views/file_history/render.lua Outdated
Comment thread lua/diffview/ui/panel.lua Outdated
@dlyongemallo dlyongemallo force-pushed the tweak_panel_autosize branch from 669fc8a to 4c91a3b Compare March 16, 2026 10:14
@dlyongemallo dlyongemallo force-pushed the tweak_panel_autosize branch from 4c91a3b to edf7bdf Compare March 16, 2026 10:22
@dlyongemallo dlyongemallo merged commit c3992d7 into main Mar 16, 2026
2 checks passed
@dlyongemallo dlyongemallo deleted the tweak_panel_autosize branch March 16, 2026 10:44
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