Commit Graph

18 Commits (master)

Author SHA1 Message Date
Junegunn Choi 2a8b65e105
Fix highlighting of regions that are matched multiple times
Fix #3596
4 months ago
Junegunn Choi f0bfeba733
Add new tiebreak: 'chunk'
Favors the line with shorter matched chunk. A chunk is a set of
consecutive non-whitespace characters.

Unlike the default `length`, this new scheme works well with tabular input.

  # length prefers item #1, because the whole line is shorter,
  # chunk prefers item #2, because the matched chunk ("foo") is shorter
  fzf --height=6 --header-lines=2 --tiebreak=chunk --reverse --query=fo << "EOF"
  N | Field1 | Field2 | Field3
  - | ------ | ------ | ------
  1 | hello  | foobar | baz
  2 | world  | foo    | bazbaz
  EOF

If the input does not contain any spaces, `chunk` is equivalent to
`length`. But we're not going to set it as the default because it is
computationally more expensive.

Close #2285
Close #2537
- Not the exact solution to --tiebreak=length not taking --nth into account,
  but this should work. And the added benefit is that it works well even
  when --nth is not provided.
- Adding a bonus point to the last character of a word didn't turn out great.
  The order of the result suddenly changes when you type in the last
  character in the word producing a jarring effect.
2 years ago
Junegunn Choi b88eb72ac2
Modernize build tags 2 years ago
Junegunn Choi bb0502ff44
Check gofmt in `make test` 3 years ago
Junegunn Choi 2983426771
Fix unit tests 4 years ago
Junegunn Choi 11841f688b
Add support for text styling using --color
Close #1663
4 years ago
Junegunn Choi 6b4805ca1a
Optimize rank comparison on x86 (little-endian) 7 years ago
Junegunn Choi bbe10f4f77
Consolidate Result and rank structs
By not storing item index twice, we can cut down the size of Result
struct and now it makes more sense to store and pass Results by values.
Benchmarks show no degradation of performance by additional pointer
indirection for looking up index.
7 years ago
Junegunn Choi 9e85cba0d0
Reduce memory footprint of Item struct 7 years ago
Junegunn Choi 2e3dc75425
Fix inconsistent tiebreak scores when --nth is used
Make sure to consistently calculate tiebreak scores based on the
original line.

This change may not be preferable if you filter aligned tabular input on
a subset of columns using --nth. However, if we calculate length
tiebreak only on the matched components instead of the entire line, the
result can be very confusing when multiple --nth components are
specified, so let's keep it simple and consistent.

Close #926
7 years ago
Junegunn Choi 1448d631a7
Add --height option 7 years ago
Michael Kelley 26895da969
Implement tcell-based renderer 8 years ago
Junegunn Choi 0c573b3dff
Prepare for termbox/windows build
`TAGS=termbox make` (or `go build -tags termbox`)
8 years ago
Junegunn Choi 0a8d2996dc
Set foreground color without affecting background
Close #712
8 years ago
Junegunn Choi 3b5ae0f8a2
Fix failing unit tests on ANSI attributes 8 years ago
Junegunn Choi 2fc7c18747
Revise ranking algorithm 8 years ago
Junegunn Choi 827a83efbc
Remove Offset slice from Result struct 8 years ago
Junegunn Choi 608c416207
Add missing sources 8 years ago