fff icon indicating copy to clipboard operation
fff copied to clipboard

feat(ui): add layout.dir_position for right-aligned directory column

Open gustav-fff opened this issue 6 months ago • 2 comments

Closes #66

Root cause

Feature request: filenames + dir paths run together with single space, hard to scan visually.

Fix

New layout.dir_position config ('left' default, 'right'). When 'right', lua/fff/file_renderer.lua pads between filename and directory so the directory column right-aligns within the list text area. Default behavior unchanged.

Diff is small (~30 LOC + 1 snapshot + README + type hint). No API change.

Steps to reproduce

vim.g.fff = {
  layout = { dir_position = 'right', prompt_position = 'bottom' },
}

Open picker. Directory paths render right-aligned:

 store.rs                                        src
 main.rs                                          src
 reference.md                                    docs

vs default 'left':

 store.rs src
 main.rs src
 reference.md docs

How verified

  • make test-lua-snap — all 20 cases pass, new snapshot dir_position---right matches.
  • Existing snapshots unchanged (default dir_position='left' is no-op path).

Automated triage via Gustav. Honk-Honk 🪿

gustav-fff avatar May 20 '26 21:05 gustav-fff

[triage-bot] DIRECTED: pushed a2b00c7.

Replaced manual padding math with extmark virt_text + virt_text_win_col — the nvim API for column-aligned overlays. Dir column rendered as virtual text on right, no inline string concatenation when dir_position='right'. Removed the +1 then subtract back arithmetic. One-space right padding via trailing virt_text chunk. Snapshot updated, all 20 cases pass.

Honk-Honk 🪿

gustav-fff avatar May 20 '26 22:05 gustav-fff

[triage-bot] DIRECTED: pushed 94efd55.

Behavior contract: filename always renders in full; on overflow the dir column is shrunk by the existing path_shorten_strategy (format_file_display reduces path_max_width from max_width - filename_width - 1). Right-align mode now reserves 2 extra columns up-front (1 separator + 1 trailing margin) so the right-aligned virt_text never collides with the filename.

New snapshot dir_position_right_overflow---narrow exercises this on 70-col geometry with a deeply nested fixture file src/components/widgets/forms/inputs/very_long_widget_name.tsx. Result: full filename rendered, dir column shrunk to src/../forms/inputs. Adjacent snapshots updated for the +1 file count.

README updated to document the contract.

make test-lua-snap — 21/21 pass.

Honk-Honk 🪿

gustav-fff avatar May 20 '26 22:05 gustav-fff