Skip to content

fix(session-picker): fix fzf-lua preview gutter and list entry layout#399

Merged
sudo-tee merged 1 commit into
sudo-tee:mainfrom
hermandavid:fix/fzf-session-picker-preview
Jun 5, 2026
Merged

fix(session-picker): fix fzf-lua preview gutter and list entry layout#399
sudo-tee merged 1 commit into
sudo-tee:mainfrom
hermandavid:fix/fzf-session-picker-preview

Conversation

@hermandavid
Copy link
Copy Markdown
Contributor

Issue

The session picker message preview (#398) has rendering issues specific to fzf-lua:

  1. First column obscured in preview pane — The formatter renders vertical border extmarks at virt_text_win_col = -3, relying on the main output window's 3-column gutter (signcolumn='yes' + foldcolumn='1'). The fzf-lua preview window has zero gutter (set_style_minimal sets signcolumn='no', foldcolumn='0'), so the border overlay lands on column 0 of the text area, obscuring the first column of every bordered line.

  2. Time column pushed off-screen — Entries are formatted to @opts.width (e.g. 100 columns), but fzf-lua's preview split leaves only ~40% of the window for the list pane (~43 columns). The right-aligned time column renders beyond the visible area.

  3. Session IDs add clutter — The list entries included session IDs that consumed layout space without adding value. IDs are already visible in the preview pane when a session is selected.

Solution

Match the preview window's gutter configuration to the main output window so the formatter's extmarks render correctly. Adjust the format width to fit the actual list pane when a preview split is active. Drop session IDs from list entries since title + datetime is sufficient for identification.

Changes

  • Preview window gutter (@session_picker.lua) — Set signcolumn='yes', foldcolumn='1', and statuscolumn='' in render_preview_buffer to provide the 3-column gutter that the formatter's virt_text_win_col = -3 border extmarks target.

  • List entry width with preview (@base_picker.lua) — After building the fzf config (which retains the full @winopts.width), narrow opts.width to the list pane width (~40% of the window minus border padding) when a preview pane is active. The format function closure reads opts.width on each call, so entries are sized to fit.

  • Session picker entries (session_picker.lua) — Remove session ID from format_session_item. The picker now shows title + datetime only.

Three fzf-lua-specific issues with the session picker preview:

1. The formatter's vertical border extmarks use virt_text_win_col = -3,
   targeting the 3-column gutter (signcolumn + foldcolumn) present in the
   main output window. The fzf-lua preview window has no gutter by default
   (set_style_minimal), so the overlay lands on column 0 of the text. Set
   signcolumn='yes' and foldcolumn='1' in the preview window to match.

2. Entries are formatted to opts.width (e.g. 100 columns), but fzf-lua's
   preview split leaves ~40% of the window for the list pane. Time columns
   end up off-screen. After building the fzf config (which keeps the full
   winopts.width), narrow opts.width to the list pane width so the format
   function sizes entries to fit.

3. Drop session IDs from picker list entries. The title + datetime is
   sufficient for identification, and IDs are visible in the preview pane
   when a session is selected.
@sudo-tee
Copy link
Copy Markdown
Owner

sudo-tee commented Jun 5, 2026

Thanks for ther PR

@sudo-tee sudo-tee merged commit 6c24ad2 into sudo-tee:main Jun 5, 2026
5 checks passed
@hermandavid hermandavid deleted the fix/fzf-session-picker-preview branch June 5, 2026 11:34
@hermandavid
Copy link
Copy Markdown
Contributor Author

hermandavid commented Jun 5, 2026

@sudo-tee Unfortunately, I have introduced a bug with this PR, I will create a follow-up PR with fix and test cases.

Sorry for that 👀

@sudo-tee
Copy link
Copy Markdown
Owner

sudo-tee commented Jun 5, 2026

@sudo-tee Unfortunately, I have introduced a bug with this PR, I will create a follow-up PR with fix and test cases.

Sorry for that 👀

No worries. As I don;t use fzf myself, I didn't notice

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