Skip to content

fix(file): use height parameter as max height#975

Open
davidferneding wants to merge 1 commit intocharmbracelet:mainfrom
davidferneding:fix/file-height
Open

fix(file): use height parameter as max height#975
davidferneding wants to merge 1 commit intocharmbracelet:mainfrom
davidferneding:fix/file-height

Conversation

@davidferneding
Copy link

While adding the padding parameter to file, the component has been refactored to use m.filepicker.SetHeight instead of the deprecated property m.filepicker.Height. Since this change, the size has been calculated based on the window height, overriding the value passed with --height.

This adds a new maxHeight property to constrain the maximum height of the file picker to the value passed by --height. The current behaviour of constraining the height to the window height has been preserved.

Refs: 6045525

Fixes #969

While adding the padding parameter to file, the component has been
refactored to use `m.filepicker.SetHeight` instead of the deprecated
property `m.filepicker.Height`. Since this change, the size has
been calculated based of the window height, overriding the value
passed with `--height`.
This adds a new `maxHeight` property to constrain the maximum
height of the file picker to the value passed by `--height`.

Refs: 6045525, charmbracelet#969
@davidferneding davidferneding requested a review from a team as a code owner October 9, 2025 12:53
@davidferneding davidferneding requested review from aymanbagabas and kujtimiihoxha and removed request for a team October 9, 2025 12:53
@tree-1917
Copy link

Hello @davidferneding, I try your solution to solve the bug in height calculation but I found it's change the behavior for the file command and can simply solve this problem by change the equation height := msg.Height - m.padding[0] - m.padding[2] - 1 it's works and you can see the screenshots before and after .

Before Bug

image

After No Bug

image

@davidferneding
Copy link
Author

Sorry @tree-1917, I totally forgot to reply.

The changes in 6045525 changed two things for the file command. One change is, that the topmost option is being cut off. This can be fixed with the change you mentioned.

The other change is, that the file command no longer respects the --height parameter, using the whole window size instead. This behaviour has been mentioned in this comment: #977 (comment)

Before v0.17.0, the file command only used a couple of lines:
image

In v0.17.0, the command clears the screen and uses all available space. This pr fixes the height behaviour.

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.

New version makes gum file command fail to correctly display

2 participants