summaryrefslogtreecommitdiff
path: root/src/result_test.go
AgeCommit message (Collapse)Author
2025-10-09Add special 'strip' style attribute for stripping colorsJunegunn Choi
Test cases: fd --color always | fzf --ansi --delimiter / fd --color always | fzf --ansi --delimiter / --nth -1 --color fg:dim,nth:regular fd --color always | fzf --ansi --delimiter / --nth -1 --color fg:dim:strip,nth:regular fd --color always | fzf --ansi --delimiter / --nth -1 --color fg:dim:strip,nth:regular --raw fd --color always | fzf --ansi --delimiter / --nth -1 --color fg:dim:strip,nth:regular,hidden:strikethrough --raw fd --color always | fzf --ansi --delimiter / --nth -1 --color fg:dim:strip,nth:regular,hidden:strip:strikethrough --raw fd --color always | fzf --ansi --delimiter / --nth -1 --color fg:dim:strip,nth:regular,hidden:strip:dim:strikethrough --raw
2025-05-30Fix ANSI attributes lost when nth:regular is setJunegunn Choi
Example: # foo was not displayed in italic echo -e "\x1b[33;3mfoo \x1b[mbar" | fzf --ansi --color fg:dim,nth:regular --nth 1
2025-05-04Add 'alt-bg' color for striped lines (#4370)Junegunn Choi
Test cases: 1. 'jump' should show alternating background colors even when 'alt-bg' is not defined as before. go run main.go --bind load:jump Two differences: * The alternating lines will not be in bold (was a bug) * The marker column will not be rendered with alternating background color 2. Use alternating background color when 'alt-bg' is set go run main.go --color bg:238,alt-bg:237 go run main.go --color bg:238,alt-bg:237 --highlight-line 3. 'selected-bg' should take precedence go run main.go --color bg:238,alt-bg:237,selected-bg:232 \ --highlight-line --multi --bind 'load:select+up+select+up' 4. Should work with text with ANSI colors declare -f | perl -0777 -pe 's/^}\n/}\0/gm' | bat --plain --language bash --color always | go run main.go --read0 --ansi --reverse --multi \ --color bg:237,alt-bg:238,current-bg:236 --highlight-line --- Close #4354 Fix #4372
2025-01-16Allow displaying --nth parts in a different text styleJunegunn Choi
Close #4183
2024-08-14Add support for hyperlinks in preview windowJunegunn Choi
Close #2165
2024-01-23Fix highlighting of regions that are matched multiple timesJunegunn Choi
Fix #3596
2022-08-02Add new tiebreak: 'chunk'Junegunn Choi
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.
2022-03-29Modernize build tagsJunegunn Choi
2021-02-28Check gofmt in `make test`Junegunn Choi
2020-11-25Fix unit testsJunegunn Choi
2020-10-25Add support for text styling using --colorJunegunn Choi
Close #1663
2017-08-27Optimize rank comparison on x86 (little-endian)Junegunn Choi
2017-07-18Consolidate Result and rank structsJunegunn Choi
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.
2017-07-16Reduce memory footprint of Item structJunegunn Choi
2017-06-02Fix inconsistent tiebreak scores when --nth is usedJunegunn Choi
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
2017-01-08Add --height optionJunegunn Choi
2016-11-07Implement tcell-based rendererMichael Kelley
2016-11-07Prepare for termbox/windows buildJunegunn Choi
`TAGS=termbox make` (or `go build -tags termbox`)
2016-10-21Set foreground color without affecting backgroundJunegunn Choi
Close #712
2016-09-29Fix failing unit tests on ANSI attributesJunegunn Choi
2016-09-18Revise ranking algorithmJunegunn Choi
2016-08-20Remove Offset slice from Result structJunegunn Choi
2016-08-19Add missing sourcesJunegunn Choi