mirror of
https://github.com/junegunn/fzf.git
synced 2025-11-14 14:23:47 -05:00
Remove header indentation when unnecessary
# Indent the header to align with the entries in the list fzf --header 'Hello' --header-border --list-border # No extra indentation required fzf --header 'Hello' --header-border
This commit is contained in:
@@ -2386,7 +2386,11 @@ func (t *Terminal) printHeaderImpl() {
|
|||||||
}
|
}
|
||||||
// Wrapping is not supported for header
|
// Wrapping is not supported for header
|
||||||
wrap := t.wrap
|
wrap := t.wrap
|
||||||
indent := strings.Repeat(" ", t.pointerLen+t.markerLen)
|
indentSize := t.pointerLen + t.markerLen
|
||||||
|
if t.headerBorderShape.HasLeft() && !t.listBorderShape.HasLeft() {
|
||||||
|
indentSize = util.Max(0, indentSize-(1+t.borderWidth))
|
||||||
|
}
|
||||||
|
indent := strings.Repeat(" ", indentSize)
|
||||||
t.wrap = false
|
t.wrap = false
|
||||||
for idx, lineStr := range append(append([]string{}, t.header0...), t.header...) {
|
for idx, lineStr := range append(append([]string{}, t.header0...), t.header...) {
|
||||||
line := idx
|
line := idx
|
||||||
|
|||||||
@@ -3588,9 +3588,9 @@ class TestGoFZF < TestBase
|
|||||||
│ 11
|
│ 11
|
||||||
│ > 10
|
│ > 10
|
||||||
│ ┌────────
|
│ ┌────────
|
||||||
│ │ 3
|
│ │ 3
|
||||||
│ │ 2
|
│ │ 2
|
||||||
│ │ 1
|
│ │ 1
|
||||||
│ └header──
|
│ └header──
|
||||||
│ 19/97 ─
|
│ 19/97 ─
|
||||||
│ > 1
|
│ > 1
|
||||||
@@ -3609,9 +3609,9 @@ class TestGoFZF < TestBase
|
|||||||
│ 19/97 ─
|
│ 19/97 ─
|
||||||
│ > 1
|
│ > 1
|
||||||
│ ┌────────
|
│ ┌────────
|
||||||
│ │ 3
|
│ │ 3
|
||||||
│ │ 2
|
│ │ 2
|
||||||
│ │ 1
|
│ │ 1
|
||||||
│ └header──
|
│ └header──
|
||||||
│
|
│
|
||||||
╰────────────
|
╰────────────
|
||||||
|
|||||||
Reference in New Issue
Block a user