junegunn / junegunn/fzf

[Feature request] Adjust the height of the preview window automatically

Open
#1,996 2 comments 8 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
83k
Forks
2.9k
Avg merge
17h 8m
Merged PRs (30d)
10

Description

- [x] I have read through the manual page (`man fzf`)
- [x] I have the latest version of fzf
- [x] I have searched through the existing issues

## Info

- OS
- [x] Linux
- Shell
- [x] zsh

## Problem / Steps to reproduce

When wrapping is set, I want you to be able to automatically adjust the height of the preview window by the length of the inputted characters.
I don't want to show margins.

### reproduce

```shell
echo aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | \
fzf --height 50% --preview "echo {}" --preview-window=up:30%:wrap
```

### argument example)

```shell
echo aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | \
fzf --height 50% --preview "echo {}" --preview-window=up:fitwrap
```

### actual behavior

![2020-04-21_11-36](https://user-images.githubusercontent.com/8683947/79819360-caf36980-83c4-11ea-927f-4b25fbf4784d.png)

### expected behavior

![2020-04-21_11-36_1](https://user-images.githubusercontent.com/8683947/79819357-ca5ad300-83c4-11ea-8872-b0c20f780c60.png)

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing fzf's --preview-window handling, especially the existing wrap and percentage-height behavior, using the reproduction command as the baseline. Done means a fitwrap-style option adjusts the preview height to wrapped input without leaving unwanted margins, while the existing preview-window behavior remains intact.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.