Check ratios before enabling preview (#174)

This commit is contained in:
ath3 2019-06-12 13:45:40 +00:00 committed by gokcehan
parent 34f39f90b2
commit eb8e516cfb

View File

@ -108,10 +108,18 @@ func (e *setExpr) eval(app *app, args []string) {
case "incsearch!":
gOpts.incsearch = !gOpts.incsearch
case "preview":
if len(gOpts.ratios) < 2 {
app.ui.echoerr("preview: 'ratios' should consist of at least two numbers before enabling 'preview'")
return
}
gOpts.preview = true
case "nopreview":
gOpts.preview = false
case "preview!":
if len(gOpts.ratios) < 2 {
app.ui.echoerr("preview: 'ratios' should consist of at least two numbers before enabling 'preview'")
return
}
gOpts.preview = !gOpts.preview
case "reverse":
gOpts.sortType.option |= reverseSort