Skip to content

Conversation

@jimeh
Copy link

@jimeh jimeh commented May 21, 2024

Note: This was a 5 minute hack just to see if I could fix it, so more than happy to hear any feedback and change things as needed :)


When previews are enabled, they typically take up half the width of the popup. This adds an option to make it double the width when preview is enabled, hence ensuring that the full text of completion items are visible.

Screenshots

Before

With preview:

Screen-Shot-2024-05-21-01-42-29 03

Without preview:

Screen-Shot-2024-05-21-01-48-16 96

After

With preview:

Screen-Shot-2024-05-21-01-43-04 51

Without preview:

Screen-Shot-2024-05-21-01-47-20 60

@jimeh jimeh changed the title feat(fit-preview): optionally double comp_length if when showing preview feat(fit-preview): optionally double comp_length when showing preview May 21, 2024
When previews are enabled, they typically take up half the width of the
popup. This adds an option to make it double the width when preview is
enabled, hence ensuring that the full text of completion items are
visible.
@z0rc
Copy link

z0rc commented Oct 23, 2024

@Aloxaf ping. Currently ftb-tmux-popup isn't usable together with fzf-preview.

@Sneethe
Copy link

Sneethe commented Jun 4, 2025

Very cool. This solves my main gripe with fzf-tab.

But I wonder, would it be difficult to trigger resizing the popup pane when toggling the preview?

I use fzf-tab-source for rich preview windows, but they're more something you want to toggle on when needed rather than having them always on. Meaning the pane will always be double its necessary width, just for the off chance the preview is toggled on.

@Sneethe
Copy link

Sneethe commented Jun 4, 2025

Very crude POC

tmux display-popup -E -w 40% -h 70% -x 10% -y 10% "fzf" &
sleep 5                 
kill $(pgrep -n "fzf")
sleep .1 
tmux display-popup -E -w 80% -h 70% -x 10% -y 10% "fzf"

Copy link

@Sneethe Sneethe left a comment

Choose a reason for hiding this comment

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

No need for the first hunk if you do this:

if zstyle -t ":fzf-tab:$_ftb_curcontext" popup-fit-preview && zstyle -m ":fzf-tab:$_ftb_curcontext" fzf-preview '*'; then
  comp_length=$(( comp_length * 2 ))
fi

Works the exact same.

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.

3 participants