diff --git a/src/options.go b/src/options.go index 39bda044..94e3a7f9 100644 --- a/src/options.go +++ b/src/options.go @@ -3699,14 +3699,7 @@ func (opts *Options) noSeparatorLine() bool { // NOTE: This does not know that the default separator can be suppressed at // runtime (see Terminal.separatorLength), so the minimum heights derived // from it can be one line taller than strictly necessary. - // - // Whether the input border draws a line on the side facing the list - // section; BorderLine always resolves to that side (see NewTerminal) - shape := opts.InputBorderShape - facingLine := shape == tui.BorderLine || - opts.Layout == layoutReverse && shape.HasBottom() || - opts.Layout != layoutReverse && shape.HasTop() - sep := opts.Separator == nil && !facingLine || opts.Separator != nil && len(*opts.Separator) > 0 + sep := opts.Separator == nil && !inputBorderFacesList(opts.Layout, opts.InputBorderShape) || opts.Separator != nil && len(*opts.Separator) > 0 return noSeparatorLine(opts.InfoStyle, sep) } diff --git a/src/terminal.go b/src/terminal.go index 4425c48a..51ad582f 100644 --- a/src/terminal.go +++ b/src/terminal.go @@ -1713,10 +1713,21 @@ func (t *Terminal) separatorLength() int { // The default horizontal separator is redundant if the input section is // already visually separated from the list section by a border line +// Whether the input border draws a line on the side facing the list section. +// BorderLine is placed on the facing side when resolved in NewTerminal. +func inputBorderFacesList(layout layoutType, shape tui.BorderShape) bool { + if shape == tui.BorderLine { + return true + } + if layout == layoutReverse { + return shape.HasBottom() + } + return shape.HasTop() +} + func (t *Terminal) separatedByBorder() bool { // The input border itself draws a line on the side facing the list section - if t.layout == layoutReverse && t.inputBorderShape.HasBottom() || - t.layout != layoutReverse && t.inputBorderShape.HasTop() { + if inputBorderFacesList(t.layout, t.inputBorderShape) { return true } for po := &t.previewOpts; po != nil; po = po.alternative {