Skip to content

fix: add layout.filename_position option (#910) - #911

Merged
dmtrKovalenko merged 2 commits into
mainfrom
triage-bot/issue-910
Oct 10, 2026
Merged

dmtrKovalenko merged 2 commits into
mainfrom
triage-bot/issue-910

Conversation

@gustav-fff

@gustav-fff gustav-fff commented Oct 8, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #910

Root cause

Preview window title (file path) alignment hardcoded title_pos = 'left' in lua/fff/picker_ui/preview_manager.lua:131 (path title), :221 (Preview placeholder) and lua/fff/layout.lua:429 (initial preview window). layout.title_position from #909 only covers the prompt/list title.

Fix

  • layout.filename_position = 'left' (default) | 'center' | 'right', independent of title_position. Invalid value falls back to 'left'.
  • Validation moved into layout.resolve_title_pos(), shared by both options. Debug file_info panel title (where the path lives in debug mode) follows the same option so it does not jump.
  • README + doc/fff.nvim.txt updated. Defaults unchanged.

Steps to reproduce

On pre-fix main:

make build
nvim --clean --cmd "set rtp^=$PWD" -c "lua vim.g.fff = { layout = { filename_position = 'center' } }" -c "lua require('fff').find_files()"

Expected: file path on preview top border centered (┬──── README.md ────┐).
Actual (main): path glued to left corner (┬ README.md ─────────┐), option silently ignored.

How verified

make build-e2e
make test-lua-snap
  • New snapshot cases filename_center/empty_{top,bottom} (tests/screenshots/tests-picker_ui_snap.lua---filename_center---*): ┬────────────────────── README.md ───────────────────────┐, FFFiles stays left. title_center_no_count/* still shows centered FFFiles with left README.md, so the two options are independent.
  • 16 query_main_* / combo / debug_* failures, identical set on clean main (a7ded8b, diffed FAIL lines). Pre-existing score drift, same as noted in fix: add layout.title_position and layout.show_file_count options (#908) #909. All empty_*, no_results_*, cursor_second_item_*, scrollbar snapshots pass unchanged.
  • layout.compute headless for left|center|right|bogus|nil x top|bottom prompt: preview title_pos resolves to given value, bogus/nil fall back to left.
  • stylua --check clean.

Automated triage via Gustav. Honk-Honk 🪿

Summary by CodeRabbit

  • New Features
    • Added a filename_position setting to align filenames in preview and file-information titles to the left, center, or right. It defaults to left alignment.
  • Tests
    • Added visual checks for centered filenames with the picker prompt at the top or bottom, and right-aligned filenames with the cursor on the second item and either prompt position.

Preview window title (file path) was hardcoded to 'left'. New option
aligns it independently of layout.title_position. Default unchanged.

Closes #910

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Your trial has ended. Reactivate Greptile to resume code reviews.

@coderabbitai

coderabbitai Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: aae2a024-24a6-4b22-b387-35541fa53266

📥 Commits

Reviewing files that changed from the base of the PR and between 1632357 and 76648e6.


📒 Files selected for processing (3)
  • tests/picker_ui_snap.lua
  • tests/screenshots/tests-picker_ui_snap.lua---filename_right---cursor_second_item_bottom
  • tests/screenshots/tests-picker_ui_snap.lua---filename_right---cursor_second_item_top

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.



📝 Walkthrough

Walkthrough

The layout configuration adds filename_position, defaulting to left. Preview and file-info titles use its resolved value. Snapshot tests cover centered and right-aligned filenames with top and bottom prompt positions.

Changes

Filename alignment

Layer / File(s) Summary
Filename position configuration
lua/fff/conf.lua, README.md, doc/fff.nvim.txt
The layout config documents filename_position as left, center, or right. Its default is left, and both configuration examples document the option.
Resolve layout title positions
lua/fff/layout.lua
The layout exports resolve_title_pos, which accepts left, center, or right and defaults invalid values to left. Preview and file-info window configs use the resolved filename position.
Apply preview positions and validate snapshots
lua/fff/picker_ui/preview_manager.lua, tests/picker_ui_snap.lua, tests/screenshots/*filename_center*, tests/screenshots/*filename_right*
Preview, file-info, and cleared-preview titles use the configured position. Snapshot cases cover centered and right-aligned filenames with top and bottom prompt positions.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Feature


Merge Risk: ⚪ Minimal · up to 76648

The filename alignment option uses its own position across preview and file-info titles, with no actionable merge-blocking risk identified.

Pre-merge checks | Passed 4 | Failed 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 11.11% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 4 files. (2 skipped: 2… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely identifies the main change: adding the layout.filename_position option.
Linked Issues check Passed Issue #910 requires a separate layout.filename_position option and preserved default behavior. The PR adds the option with default 'left', validates left, center, and right, and falls back t…
Out of Scope Changes check Passed The changes stay within issue #910. They add configuration, shared validation, preview and debug title handling, documentation, and focused snapshot tests. No unrelated change is shown.

Full details: Docstring Coverage

Explanation

Docstring coverage is 11.11% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 4 files. (2 skipped: 2 unsupported.)


  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR


🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@dmtrKovalenko

Copy link
Copy Markdown
Owner
image

@gustav-fff make a test for the filename that is different from the current default

Moves cursor to docs/changelog.md so the preview title is re-set via update_preview_title, covering both prompt positions.
@gustav-fff

Copy link
Copy Markdown
Collaborator Author

[triage-bot] DIRECTED: pushed 76648e6, new snapshot set filename_right.

tests/picker_ui_snap.lua filename_right/cursor_second_item_{top,bottom}: filename_position = 'right', cursor moved off README.md onto docs/changelog.md (<Down> top, <Up> bottom). Both the position and the previewed file now differ from the default, and the title is re-set through update_preview_title on cursor move, not only at open.

┌ FFFiles ──────────────────────────┬─────────────────── docs/changelog.md ┐

make test-lua-snap: new cases pass on rerun. Same 16 pre-existing query_main_* / combo / debug_* failures as before, unrelated. stylua --check clean.

If you wanted something else, e.g. center on a non-README file, say so.

Honk-Honk 🪿

@dmtrKovalenko
dmtrKovalenko merged commit f64bab2 into main Oct 10, 2026
54 checks passed
wpenistone pushed a commit to wpenistone/fffork that referenced this pull request Oct 13, 2026
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.

[Suggestion]: Add configurable filename alignment

2 participants