Extract inputBorderFacesList helper

Facing-side rule was written out separately in options.go and
terminal.go; single helper prevents the two from drifting apart
This commit is contained in:
Junegunn Choi
2026-07-18 01:43:12 +09:00
parent 711f810630
commit 5aab8979c6
2 changed files with 14 additions and 10 deletions
+13 -2
View File
@@ -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 {