From eb8e516cfb9592f91562d010a86b98c2a96944a4 Mon Sep 17 00:00:00 2001 From: ath3 <45574139+ath3@users.noreply.github.com> Date: Wed, 12 Jun 2019 13:45:40 +0000 Subject: [PATCH] Check ratios before enabling preview (#174) --- eval.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/eval.go b/eval.go index 5ce5efc..1fd95d5 100644 --- a/eval.go +++ b/eval.go @@ -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