Skip to content

feat: dynamic preview pane width based on terminal size#762

Merged
dlvhdr merged 13 commits intodlvhdr:mainfrom
trolleksii:dynamic-preview-pane-width
Feb 10, 2026
Merged

feat: dynamic preview pane width based on terminal size#762
dlvhdr merged 13 commits intodlvhdr:mainfrom
trolleksii:dynamic-preview-pane-width

Conversation

@trolleksii
Copy link
Contributor

Summary

The preview pane width is currently configured as a static number. This works perfectly fine when terminal window size remains unchanged. However in cases where terminal window changes(eg tmux vertical splits, switching from the laptop screen to an ultra-wide external monitor, etc) the layout gets messed up which may be quite frustrating.

I attempted to add the capability to set preview pane width as a fraction. Now defaults.preview.width accepts floats where:

0 to 1 → treated as a fraction (e.g., 0.4 = 40% of terminal width)
Above 1 → converted to int and works as before (backward compatible)

Note: This is my first contribution to the project, so let me know if there's anything that should be adjusted to better match the overall architecture or coding conventions.

How did you test this change?

I added a couple of tests to cover the change plus manual testing.

Images/Videos

Example with with set to 0.45
Fullscreen:
image
With vertical split:
image

Copy link
Owner

@dlvhdr dlvhdr left a comment

Choose a reason for hiding this comment

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

looks really good! thinking about it, should we change the default width to be
percenrage based? I'm not sure what's a better default

Co-authored-by: Dolev Hadar <6196971+dlvhdr@users.noreply.github.com>
@trolleksii
Copy link
Contributor Author

looks really good! thinking about it, should we change the default width to be percenrage based? I'm not sure what's a better default

I also think that something close to 50% could be a good starting point. I didn't want to impose my preferences but if we agree on this matter I can adjust the default.

@trolleksii trolleksii requested a review from dlvhdr February 7, 2026 22:44
@dlvhdr
Copy link
Owner

dlvhdr commented Feb 8, 2026

@trolleksii can we make it 0.45 as the default?

@trolleksii
Copy link
Contributor Author

Done

dlvhdr
dlvhdr previously approved these changes Feb 9, 2026
@trolleksii
Copy link
Contributor Author

@dlvhdr can you please re-run the ci. I messed up test file when pulled main in and resolved conflicts in github ui 🤦

@dlvhdr dlvhdr merged commit db780f8 into dlvhdr:main Feb 10, 2026
3 of 4 checks passed
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