Skip to content
Myr

Header and footer should not be wider than the list

Before adoption: this commit came in with the history the project adopted, so no landing records it.

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

authored by Junegunn Choi · committed by Junegunn Choi · parent 3f499f0 · Browse files · 2 files+16 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Trailers

  • 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

Diff stats

2 files+16 added−1 removed

  • tests:+9 added−0 removed
  • other:+7 added−1 removed

2 files+16 added−1 removed

modified:src/terminal.go+7 added-1 removed
2488 unmodified lines
2489 width := b.Width() - borderColumns(shape, t.borderWidth) - shift2490 if shape.HasRight() {2491 width++2492 }2493 // Make sure that the width does not exceed the list width2494 width = util.Min(t.window.Width()+t.headerIndentImpl(0, shape), width)2495 height := b.Height() - borderLines(shape)2496 return t.tui.NewWindow(top, left, width, height, windowType, noBorder, true)2497 }2498
609 unmodified lines
3108 t.wrap = wrap3109}31103111func (t *Terminal) headerIndent(borderShape tui.BorderShape) int {3110 indentSize := t.pointerLen + t.markerLen3112 return t.headerIndentImpl(t.pointerLen+t.markerLen, borderShape)3113}31143115func (t *Terminal) headerIndentImpl(base int, borderShape tui.BorderShape) int {3116 indentSize := base3117 if t.listBorderShape.HasLeft() {3118 indentSize += 1 + t.borderWidth3119 }3120 if borderShape.HasLeft() {
4257 unmodified lines
modified:test/test_layout.rb+9 added
1213 unmodified lines
1214 lines.any? { it.match?(/x·· │ y+│$/) }1215 end1216 end12171218 def test_header_and_footer_should_not_be_wider_than_list1219 tmux.send_keys %(WIDE=$(printf 'x%.0s' {1..1000}); (echo $WIDE; echo $WIDE) | fzf --header-lines 1 --style full --header-border bottom --header-lines-border top --ellipsis XX --header "$WIDE" --footer "$WIDE" --no-footer-border), :Enter1220 tmux.until do |lines|1221 matches = lines.filter_map { |line| line[/x+XX/] }1222 assert_equal 4, matches.length1223 assert_equal 1, matches.uniq.length1224 end1225 end12261227 def test_combinations1228 skip unless ENV['LONGTEST']12291230 base = [
71 unmodified lines