Skip to content
Myr

Allow adaptive height with negative value

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Fix #4682

authored by Junegunn Choi · committed by Junegunn Choi · parent d7a132b · Browse files · 2 files+8 added−9 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+8 added−9 removed

  • other:+8 added−9 removed

2 files+8 added−9 removed

modified:man/man1/fzf.1+6 added-4 removed
382 unmodified lines
383Use black background384385.SS DISPLAY MODE386.TP387.BI "\-\-height=" "[~]HEIGHT[%]"387.BI "\-\-height=" "[~][\-]HEIGHT[%]"388Display fzf window below the cursor with the given height instead of using389the full screen.390391If a negative value is specified, the height is calculated as the terminal
1 unmodified line
393394 fzf \-\-height=\-1395396When prefixed with \fB~\fR, fzf will automatically determine the height in the397range according to the input size.397range according to the input size. You can combine \fB~\fR with a negative398value.399400 # Will not take up 100% of the screen401 seq 5 | fzf \-\-height=~100%402403 # Adapt to input size, up to terminal height minus 1404 seq 5 | fzf \-\-height=~\-1405406Adaptive height has the following limitations:407.br408* Cannot be used with top/bottom margin and padding given in percent size409.br406* Negative value is not allowed407.br410* It will not find the right size when there are multi-line items411412.TP413.BI "\-\-min\-height=" "HEIGHT[+]"
1858 unmodified lines
modified:src/options.go+2 added-5 removed
64 unmodified lines
65 --no-color Disable colors66 --no-bold Do not use bold text6768 DISPLAY MODE69 --height=[~]HEIGHT[%] Display fzf window below the cursor with the given69 --height=[~][-]HEIGHT[%] Display fzf window below the cursor with the given70 height instead of using fullscreen.71 A negative value is calculated as the terminal height72 minus the given value.73 If prefixed with '~', fzf will determine the height
2147 unmodified lines
2221 heightSpec.auto = true2222 str = str[1:]2223 }2224 if strings.HasPrefix(str, "-") {2225 if heightSpec.auto {2226 return heightSpec, errors.New("negative(-) height is not compatible with adaptive(~) height")2227 }2225 heightSpec.inverse = true2226 str = str[1:]2227 }2228
919 unmodified lines
3148 return err3149 }3150 opts.PreviewWrapSign = &str3151 case "--height":3155 str, err := nextString("height required: [~]HEIGHT[%]")3152 str, err := nextString("height required: [~][-]HEIGHT[%]")3153 if err != nil {3154 return err3155 }3156 if opts.Height, err = parseHeight(str, index); err != nil {
775 unmodified lines