Skip to content

feat: add flexible layout customization with dynamic positioning#69

Merged
dmtrKovalenko merged 22 commits into
dmtrKovalenko:mainfrom
sQVe:feat/allow-layout-customization
Aug 17, 2025
Merged

feat: add flexible layout customization with dynamic positioning#69
dmtrKovalenko merged 22 commits into
dmtrKovalenko:mainfrom
sQVe:feat/allow-layout-customization

Conversation

@sQVe

@sQVe sQVe commented Aug 6, 2025

Copy link
Copy Markdown
Contributor

Summary

Adds configurable layout positioning for the preview panel and prompt. Preview can be positioned left, right, top, or bottom, or disabled entirely. Prompt can be at top or bottom. Layout options support both static values and functions for dynamic sizing based on terminal dimensions.

Changes

  • Multi-position preview support: Preview positioning supports left/right/top/bottom options with proper disable support
  • Dynamic prompt positioning: Prompt can be positioned at top or bottom with proper layout calculations
  • Function-based configuration: Layout options accept functions that receive terminal dimensions
  • Deprecation system: Automatic migration of old config options with user warnings
  • Updated documentation: Examples and configuration reference for new layout options

Test Plan

  • Test all four preview positions (left/right/top/bottom) with different terminal sizes
  • Verify preview can be properly disabled (preview.enabled = false)
  • Verify prompt positioning (top/bottom) works correctly with each preview position
  • Test function-based configurations respond to terminal resizing
  • Confirm deprecated config options show warnings and migrate correctly
  • Check existing configurations continue working without changes
  • Test edge cases with very small terminal windows
  • Verify debug panel positioning works with all layout combinations

Backward Compatibility

Existing configurations work unchanged. Deprecated options are automatically migrated with warnings guiding users to the new structure.

sQVe added 11 commits August 5, 2025 22:57
Allows users to position the input prompt at 'top' or 'bottom' of the picker window.
When prompt is at top, best matches appear at the top (closest to prompt).
When prompt is at bottom (default), best matches appear at the bottom.

- Add prompt_position config option with validation
- Adapt list rendering order based on prompt position
- Fix cursor navigation to work correctly with both layouts
- Optimize array reversal for better performance
- Extract helper function to reduce code duplication
Move width/height into layout namespace for better organization.
Adds max_threads field and reorganizes config hierarchy to be
more intuitive and extensible.

BREAKING CHANGE: config.width/height moved to config.layout.width/height
Replace hardcoded deprecation handling with rule-based system
for easier maintenance. Each deprecation is now defined as a
simple rule with old_path, new_path, and message.

Enables easy addition of future config deprecations without
touching core migration logic.
Replace repetitive inline pcall functions with centralized utilities in fff.utils.
Eliminates code duplication and improves error handling consistency across
dynamic configuration resolution.
Implement structured deprecation rules for configuration migration,
enabling smooth transition from legacy config options while maintaining
backward compatibility and clear user warnings.
Document all supported preview positions (left, right, top, bottom) and
preview_size parameter, removing outdated limitation claims and ensuring
configuration examples match current capabilities.
Document complete configuration API including dynamic functions, all preview
settings, logging, frecency, UI options, and automatic migration system.
Ensures users understand both static and responsive configuration patterns.
Standardize comment alignment across configuration examples in README.md
and doc/fff.nvim.txt to create consistent visual structure and make
configuration options easier to scan and understand.
Standardize comment alignment across all code blocks in both README.md
and doc/fff.nvim.txt including configuration examples, method calls,
and keymap examples for consistent visual structure and readability.
Standardize comment alignment for better readability and consistency
across README and generated vimdoc files.
@sQVe sQVe marked this pull request as draft August 6, 2025 09:55
…sitions

Resolves inconsistent window positioning that caused preview windows to be
misaligned or hidden in certain layout combinations (e.g., prompt_position='top'
with preview_position='bottom'). Standardizes the coordinate calculation logic
to ensure proper alignment and separation between windows for all four preview
positions while maintaining the original +3 border/separator spacing.
@sQVe

sQVe commented Aug 6, 2025

Copy link
Copy Markdown
Contributor Author
2025-08-06_12-29 2025-08-06_12-30_1 2025-08-06_12-30 2025-08-06_12-31

@sQVe sQVe marked this pull request as ready for review August 6, 2025 10:32
@dmtrKovalenko

Copy link
Copy Markdown
Owner

for the input bottom or top we should make a rust change to return the correctly ordered list, if you put preview on the top the top match should be on the top, currently we are getting already sorted list from rust

@sQVe sQVe requested a review from dmtrKovalenko August 11, 2025 18:35
@sQVe

sQVe commented Aug 11, 2025

Copy link
Copy Markdown
Contributor Author

for the input bottom or top we should make a rust change to return the correctly ordered list, if you put preview on the top the top match should be on the top, currently we are getting already sorted list from rust

This should be fixed with 099aa20.

@dmtrKovalenko

Copy link
Copy Markdown
Owner
image I pulled the changes and with the default config it selectes the first element

@sQVe

sQVe commented Aug 13, 2025

Copy link
Copy Markdown
Contributor Author

I pulled the changes and with the default config it selectes the first element

🙈 I'll take a look later today and ensure that it works as intended!

Fixes cursor positioning calculation to properly highlight the selected
item when using bottom prompt layout. The cursor line calculation now
accounts for the inverted display order in bottom mode.
@sQVe

sQVe commented Aug 13, 2025

Copy link
Copy Markdown
Contributor Author

@dmtrKovalenko Should be good to go now.

# Conflicts:
#	lua/fff/main.lua
#	lua/fff/rust/file_picker.rs
@dmtrKovalenko

Copy link
Copy Markdown
Owner

I think now the selection is broken it shows one file but opens completely different one. We should probably already write some end to end tests becuase it is becoming hard to maintain all the edge cases

@sQVe

sQVe commented Aug 16, 2025

Copy link
Copy Markdown
Contributor Author

@dmtrKovalenko Do you have any suggestions on how you would like to setup these end to end tests?

@dmtrKovalenko

Copy link
Copy Markdown
Owner

I'll fix this branch myself and will add some tests later, thanks. I think we need a little bit restructuring and preparation to implement pagination

@dmtrKovalenko

Copy link
Copy Markdown
Owner

I'm half way there already

@dmtrKovalenko dmtrKovalenko merged commit 7c8a941 into dmtrKovalenko:main Aug 17, 2025
7 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