mirror of
https://github.com/junegunn/fzf.git
synced 2026-08-07 16:38:38 +08:00
Apply facing-line rule to input border as well
Visible input border suppressed separator even when it draws no line toward list section (bottom in default layout, top in reverse, vertical). Suppress only when input border has a line on the list side; otherwise fall through to adjacent section check. Also requires header window to have content before treating it as the facing section; hasHeaderWindow returns true with empty header when input border is visible.
This commit is contained in:
+9
-3
@@ -1714,7 +1714,9 @@ 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
|
||||
func (t *Terminal) separatedByBorder() bool {
|
||||
if t.inputBorderShape.Visible() {
|
||||
// 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() {
|
||||
return true
|
||||
}
|
||||
for po := &t.previewOpts; po != nil; po = po.alternative {
|
||||
@@ -1727,7 +1729,7 @@ func (t *Terminal) separatedByBorder() bool {
|
||||
}
|
||||
hasHeaderLinesWindow, headerLinesShape := t.determineHeaderLinesShape()
|
||||
hasHeaderWindow := t.hasHeaderWindow()
|
||||
if !hasHeaderWindow && !hasHeaderLinesWindow {
|
||||
if !t.inputBorderShape.Visible() && !hasHeaderWindow && !hasHeaderLinesWindow {
|
||||
// No separate window is created for the input section in this case
|
||||
// (see hasInputWindow in resizeWindows), i.e. the input section is
|
||||
// embedded in the list window and no border separates the two
|
||||
@@ -1736,7 +1738,11 @@ func (t *Terminal) separatedByBorder() bool {
|
||||
|
||||
// The input section has its own window. Determine which section it is
|
||||
// facing, and check if the border of that section draws a line toward it.
|
||||
if hasHeaderWindow && !t.headerFirst && t.headerBorderShape != tui.BorderInline {
|
||||
// NOTE: hasHeaderWindow can be true with no header content when the input
|
||||
// border is visible (see Terminal.hasHeaderWindow). An empty header window
|
||||
// takes no space, so it cannot be the facing section.
|
||||
hasHeaderSection := hasHeaderWindow && len(t.header0)+t.headerLines > 0
|
||||
if hasHeaderSection && !t.headerFirst && t.headerBorderShape != tui.BorderInline {
|
||||
// Header section; an inline header is not a separate section, it is
|
||||
// drawn inside the list border, so it falls through to the branches
|
||||
// below
|
||||
|
||||
Reference in New Issue
Block a user