m/fzf
1
0
mirror of https://github.com/junegunn/fzf.git synced 2025-11-16 15:23:48 -05:00

Header and footer should not be wider than the list

Example:
  WIDE=$(printf 'x%.0s' {1..1000})
  (echo $WIDE; echo $WIDE) |
    fzf --header-lines 1 --style full --ellipsis XX --header "$WIDE" \
        --no-header-lines-border --footer "$WIDE" --no-footer-border
This commit is contained in:
Junegunn Choi
2025-11-15 11:36:56 +09:00
parent 3f499f055e
commit 60b35e748b
2 changed files with 16 additions and 1 deletions

View File

@@ -2490,6 +2490,8 @@ func (t *Terminal) resizeWindows(forcePreview bool, redrawBorder bool) {
if shape.HasRight() {
width++
}
// Make sure that the width does not exceed the list width
width = util.Min(t.window.Width()+t.headerIndentImpl(0, shape), width)
height := b.Height() - borderLines(shape)
return t.tui.NewWindow(top, left, width, height, windowType, noBorder, true)
}
@@ -3107,7 +3109,11 @@ func (t *Terminal) printFooter() {
}
func (t *Terminal) headerIndent(borderShape tui.BorderShape) int {
indentSize := t.pointerLen + t.markerLen
return t.headerIndentImpl(t.pointerLen+t.markerLen, borderShape)
}
func (t *Terminal) headerIndentImpl(base int, borderShape tui.BorderShape) int {
indentSize := base
if t.listBorderShape.HasLeft() {
indentSize += 1 + t.borderWidth
}