Add height option to fuzzy finder and improve list height calculation #261
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.
This PR adds comprehensive dimension control and a robust layout system to the fuzzy finder, providing greater control over its appearance and fixing critical feature coordination issues.
Key Changes:
Customizable Border
WithBorder()andWithBorderChars()options to enable and style a window border.╭╮╰╯─│.Configurable Height and Width
WithHeight()andWithWidth()options to set fixed dimensions.WithHeight()is used, the finder now positions at the bottom of the terminal (like fzf), not centered.Layout System Architecture (Major Refactor)
Layoutabstraction system withrecttype for rectangular areas.computeLayout()function as single source of truth for all UI component positions._draw(),_drawPreview(),_drawBorder()) to use shared layout coordinates.Code Quality Improvements
listWidth()function.Dependency Management & Fixes
go-isattyandpflagdependencies for the example application.Example and Documentation
README.mdwith build and test instructions.Technical Details:
Before: Features calculated positions independently, causing conflicts:
f.term.Size()directly)After: Clean architecture with single layout calculation:
Layoutstruct with pre-calculated coordinatesTesting:
All tests pass (1.6s runtime):
recthelper methodsBreaking Changes:
None. While the internal architecture was significantly refactored, the public API remains unchanged and all existing tests pass.