:hidden property of previous --preview-window should be cleared
Fix #636. Patch suggested by @edi9999.
This commit is contained in:
parent
7cef92fffe
commit
1e74dbb937
@ -724,6 +724,7 @@ func parseSize(str string, maxPercent float64, label string) sizeSpec {
|
|||||||
|
|
||||||
func parsePreviewWindow(opts *previewOpts, input string) {
|
func parsePreviewWindow(opts *previewOpts, input string) {
|
||||||
layout := input
|
layout := input
|
||||||
|
opts.hidden = false
|
||||||
if strings.HasSuffix(layout, ":hidden") {
|
if strings.HasSuffix(layout, ":hidden") {
|
||||||
opts.hidden = true
|
opts.hidden = true
|
||||||
layout = strings.TrimSuffix(layout, ":hidden")
|
layout = strings.TrimSuffix(layout, ":hidden")
|
||||||
|
@ -352,14 +352,14 @@ func TestDefaultCtrlNP(t *testing.T) {
|
|||||||
check([]string{hist, "--bind=ctrl-p:accept"}, curses.CtrlP, actAccept)
|
check([]string{hist, "--bind=ctrl-p:accept"}, curses.CtrlP, actAccept)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestToggle(t *testing.T) {
|
func optsFor(words ...string) *Options {
|
||||||
optsFor := func(words ...string) *Options {
|
opts := defaultOptions()
|
||||||
opts := defaultOptions()
|
parseOptions(opts, words)
|
||||||
parseOptions(opts, words)
|
postProcessOptions(opts)
|
||||||
postProcessOptions(opts)
|
return opts
|
||||||
return opts
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
func TestToggle(t *testing.T) {
|
||||||
opts := optsFor()
|
opts := optsFor()
|
||||||
if opts.ToggleSort {
|
if opts.ToggleSort {
|
||||||
t.Error()
|
t.Error()
|
||||||
@ -375,3 +375,31 @@ func TestToggle(t *testing.T) {
|
|||||||
t.Error()
|
t.Error()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestPreviewOpts(t *testing.T) {
|
||||||
|
opts := optsFor()
|
||||||
|
if !(opts.Preview.command == "" &&
|
||||||
|
opts.Preview.hidden == false &&
|
||||||
|
opts.Preview.position == posRight &&
|
||||||
|
opts.Preview.size.percent == true &&
|
||||||
|
opts.Preview.size.size == 50) {
|
||||||
|
t.Error()
|
||||||
|
}
|
||||||
|
opts = optsFor("--preview", "cat {}", "--preview-window=left:15:hidden")
|
||||||
|
if !(opts.Preview.command == "cat {}" &&
|
||||||
|
opts.Preview.hidden == true &&
|
||||||
|
opts.Preview.position == posLeft &&
|
||||||
|
opts.Preview.size.percent == false &&
|
||||||
|
opts.Preview.size.size == 15+2) {
|
||||||
|
t.Error(opts.Preview)
|
||||||
|
}
|
||||||
|
|
||||||
|
opts = optsFor("--preview-window=left:15:hidden", "--preview-window=down")
|
||||||
|
if !(opts.Preview.command == "" &&
|
||||||
|
opts.Preview.hidden == false &&
|
||||||
|
opts.Preview.position == posDown &&
|
||||||
|
opts.Preview.size.percent == true &&
|
||||||
|
opts.Preview.size.size == 50) {
|
||||||
|
t.Error(opts.Preview)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user