Skip to content
Myr

Fix --header-lines unaffected by --with-nth

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

authored by Junegunn Choi · committed by Junegunn Choi · parent 928fccc · Browse files · 3 files+22 added−6 removed
This commit

State

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

Diff stats

3 files+22 added−6 removed

  • tests:+13 added−1 removed
  • other:+9 added−5 removed

3 files+22 added−6 removed

modified:man/man1/fzf.1+6 added-2 removed
258 unmodified lines
259automatically truncated when the number of the lines exceeds the value.260.TP261.BI "--header-file=" "FILE"262The content of the file will be printed as the sticky header. The file can263span multiple lines and can contain ANSI color codes.263span multiple lines and can contain ANSI color codes. The lines in the file are264displayed from top to bottom regardless of \fB--reverse\fR, and are265not affected by \fB--with-nth\fR.266.TP267.BI "--header-lines=" "N"266The first N lines of the input are treated as the sticky header.268The first N lines of the input are treated as the sticky header. When269\fB--with-nth\fR is set, the lines are transformed just like the other270lines that follow.271.SS Scripting272.TP273.BI "-q, --query=" "STR"274Start the finder with the given query
101 unmodified lines
modified:src/core.go+3 added-3 removed
102 unmodified lines
103 rank: Rank{0, 0, uint32(index)}}104 })105 } else {106 chunkList = NewChunkList(func(data *string, index int) *Item {107 tokens := Tokenize(data, opts.Delimiter)108 trans := Transform(tokens, opts.WithNth)109 if len(header) < opts.HeaderLines {108 header = append(header, *data)110 header = append(header, *joinTokens(trans))111 eventBox.Set(EvtHeader, header)112 return nil113 }112 tokens := Tokenize(data, opts.Delimiter)113 trans := Transform(tokens, opts.WithNth)114 item := Item{115 text: joinTokens(trans),116 origText: data,117 index: uint32(index),
150 unmodified lines
modified:test/test_go.rb+13 added-1 removed
686 unmodified lines
687 tmux.send_keys :Enter688 assert_equal '', readonce.chomp689 end690691 def test_header_lines_with_nth692 tmux.send_keys "seq 100 | #{fzf "--header-lines 5 --with-nth 1,1,1,1,1"}", :Enter693 tmux.until do |lines|694 lines[-2].include?('95/95') &&695 lines[-3] == ' 11111' &&696 lines[-7] == ' 55555' &&697 lines[-8] == '> 66666'698 end699 tmux.send_keys :Enter700 assert_equal '6', readonce.chomp701 end702703 def test_header_file704 tmux.send_keys "seq 100 | #{fzf "--header-file <(head -5 #{__FILE__})"}", :Enter705 header = File.readlines(__FILE__).take(5).map(&:strip)706 tmux.until do |lines|
2 unmodified lines
709 end710 end711712 def test_header_file_reverse701 tmux.send_keys "seq 100 | #{fzf "--header-file <(head -5 #{__FILE__}) --reverse"}", :Enter713 tmux.send_keys "seq 100 | #{fzf "--header-file=<(head -5 #{__FILE__}) --reverse"}", :Enter714 header = File.readlines(__FILE__).take(5).map(&:strip)715 tmux.until do |lines|716 lines[1].include?('100/100') &&717 lines[2..6].map(&:strip) == header
244 unmodified lines