m/fzf
1
0
mirror of https://github.com/junegunn/fzf.git synced 2025-11-14 14:23:47 -05:00

Add --min-height option for percent --height

This commit is contained in:
Junegunn Choi
2017-01-10 01:04:36 +09:00
parent 78a3f81972
commit 340af463cd
3 changed files with 18 additions and 5 deletions

View File

@@ -275,14 +275,15 @@ func NewTerminal(opts *Options, eventBox *util.EventBox) *Terminal {
maxHeightFunc := func(termHeight int) int {
var maxHeight int
if opts.Height.percent {
maxHeight = int(opts.Height.size * float64(termHeight) / 100.0)
maxHeight = util.Min(termHeight,
util.Max(int(opts.Height.size*float64(termHeight)/100.0), opts.MinHeight))
} else {
maxHeight = util.Min(int(opts.Height.size), termHeight)
maxHeight = util.Min(termHeight, int(opts.Height.size))
}
if opts.InlineInfo {
return util.Max(maxHeight, 3)
return util.Max(maxHeight, minHeight-1)
}
return util.Max(maxHeight, 4)
return util.Max(maxHeight, minHeight)
}
renderer = tui.NewLightRenderer(opts.Theme, opts.Black, opts.Mouse, opts.Tabstop, maxHeightFunc)
} else {