Skip to content
Myr

Fix panic on inverse match query with `--tiebreak=chunk`

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

Fix #3055

authored by Junegunn Choi · committed by Junegunn Choi · parent 3da63f3 · Browse files · 3 files+20 added−11 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+20 added−11 removed

  • tests:+4 added−0 removed
  • other:+16 added−11 removed

3 files+20 added−11 removed

modified:src/result.go+12 added-11 removed
48 unmodified lines
49 case byScore:50 // Higher is better51 val = math.MaxUint16 - util.AsUint16(score)52 case byChunk:53 b := minBegin54 e := maxEnd55 l := item.text.Length()56 for ; b >= 1; b-- {57 if unicode.IsSpace(item.text.Get(b - 1)) {58 break53 if validOffsetFound {54 b := minBegin55 e := maxEnd56 for ; b >= 1; b-- {57 if unicode.IsSpace(item.text.Get(b - 1)) {58 break59 }60 }60 }61 for ; e < l; e++ {62 if unicode.IsSpace(item.text.Get(e)) {63 break61 for ; e < numChars; e++ {62 if unicode.IsSpace(item.text.Get(e)) {63 break64 }65 }66 val = util.AsUint16(e - b)67 }66 val = util.AsUint16(e - b)68 case byLength:69 val = item.TrimLength()70 case byBegin, byEnd:71 if validOffsetFound {
188 unmodified lines
modified:test/test_go.rb+4 added
777 unmodified lines
778 '1 foobarbaz ba',779 '2 foobar baz',780 '3 foo barbaz'781 ], `#{FZF} -fba --tiebreak=chunk < #{tempname}`.lines(chomp: true)782783 assert_equal [784 '3 foo barbaz'785 ], `#{FZF} -f'!foobar' --tiebreak=chunk < #{tempname}`.lines(chomp: true)786 end787788 def test_invalid_cache789 tmux.send_keys "(echo d; echo D; echo x) | #{fzf('-q d')}", :Enter
2104 unmodified lines
modified:CHANGELOG.md+4 added
1CHANGELOG2=========340.35.15------6- Fixed a bug where fzf with `--tiebreak=chunk` crashes on inverse match query780.35.09------10- Added `start` event that is triggered only once when fzf finder starts.11 Since fzf consumes the input stream asynchronously, the input list is not
1380 unmodified lines