summaryrefslogtreecommitdiff
path: root/src/result.go
AgeCommit message (Collapse)Author
2025-10-09Rename: '--color hidden' to '--color nomatch'Junegunn Choi
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-08-15Use fixed-length array when possible (#4488)Ioannis Pinakoulakis
2025-08-03Fix '--color nth:regular' not to reset ANSI attributes of the original textJunegunn Choi
2025-06-25Support full-line background color in the list sectionJunegunn Choi
Close #4432
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-30--no-color: Keep ANSI attributes in the listJunegunn Choi
Example: echo -e "\x1b[33;3mfoo \x1b[34;4mbar\x1b[m baz" | fzf --ansi --no-color
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-24Option to prioritize file name matches (#4192)Junegunn Choi
* 'pathname' is a new tiebreak option for prioritizing matches occurring in the file name of the path. * `--scheme=path` will automatically set `--tiebreak=pathname,length`. * fzf will automatically choose `path` scheme when the input is a TTY device, where fzf would start its built-in walker or run `$FZF_DEFAULT_COMMAND` which is usually a command for listing files. Close #4191
2025-01-20Make 'current-fg' inherit from 'fg' to simplify configurationJunegunn Choi
If you do not want 'current-fg' to inherit attributes of 'fg', prefix it with 'regular:' to reset them. # italic and underline fzf --color fg:italic,current-fg:underline # only underline fzf --color fg:italic,current-fg:regular:underline
2025-01-16Allow displaying --nth parts in a different text styleJunegunn Choi
Close #4183
2024-08-14Support hyperlinks (OSC 8) in the main windowJunegunn Choi
Close #2557
2024-06-10Fix divide by zero error with --tiebreak=end for long itemsJunegunn Choi
Fix #3846
2024-05-20Implement multi-line display of multi-line itemsJunegunn Choi
2024-01-23Fix highlighting of regions that are matched multiple timesJunegunn Choi
Fix #3596
2023-12-26Fix unexpected result of --tiebreak=endJunegunn Choi
See https://github.com/junegunn/fzf/issues/3255#issuecomment-1869580320
2022-11-18Fix panic on inverse match query with `--tiebreak=chunk`Junegunn Choi
Fix #3055
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.
2021-01-15Fix typos in source code (#2322)freddii
2020-12-04Change how hl:-1 or hl+:-1 is applied to text with background colorJunegunn Choi
2020-10-25Add support for text styling using --colorJunegunn Choi
Close #1663
2019-11-05Improvements to code quality and readability (#1737)Alexandr
* Remove 1 unused field and 3 unused functions unused elements fount by running golangci-lint run --disable-all --enable unused src/result.go:19:2: field `index` is unused (unused) index int32 ^ src/tui/light.go:716:23: func `(*LightWindow).stderr` is unused (unused) func (w *LightWindow) stderr(str string) { ^ src/terminal.go:1015:6: func `numLinesMax` is unused (unused) func numLinesMax(str string, max int) int { ^ src/tui/tui.go:167:20: func `ColorPair.is24` is unused (unused) func (p ColorPair) is24() bool { ^ * Address warnings from "gosimple" linter src/options.go:389:83: S1003: should use strings.Contains(str, ",,,") instead (gosimple) if str == "," || strings.HasPrefix(str, ",,") || strings.HasSuffix(str, ",,") || strings.Index(str, ",,,") >= 0 { ^ src/options.go:630:18: S1007: should use raw string (`...`) with regexp.MustCompile to avoid having to escape twice (gosimple) executeRegexp = regexp.MustCompile( ^ src/terminal.go:29:16: S1007: should use raw string (`...`) with regexp.MustCompile to avoid having to escape twice (gosimple) placeholder = regexp.MustCompile("\\\\?(?:{[+sf]*[0-9,-.]*}|{q}|{\\+?f?nf?})") ^ src/terminal_test.go:92:10: S1007: should use raw string (`...`) with regexp.MustCompile to avoid having to escape twice (gosimple) regex = regexp.MustCompile("\\w+") ^ * Address warnings from "staticcheck" linter src/algo/algo.go:374:2: SA4006: this value of `offset32` is never used (staticcheck) offset32, T := alloc32(offset32, slab, N) ^ src/algo/algo.go:456:2: SA4006: this value of `offset16` is never used (staticcheck) offset16, C := alloc16(offset16, slab, width*M) ^ src/tui/tui.go:119:2: SA9004: only the first constant in this group has an explicit type (staticcheck) colUndefined Color = -2 ^
2017-08-27Optimize rank comparison on x86 (little-endian)Junegunn Choi
2017-08-15Remove special nilItemJunegunn 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-02-02Fix --tiebreak=begin with algo v2Junegunn Choi
Due to performance consideration, FuzzyMatchV2 does not return the exact positions of the matching characters by default. However, the ommission caused `--tiebreak=begin` to produce inaccurate result in some cases. (echo baz foo bar; echo foo bar baz) | fzf --tiebreak=begin -fbar | head -1 # Expected: foo bar baz # Actual: baz foo bar This commit fixes the problem by using the end offset which is guaranteed to be correct.
2017-01-08Add --height optionJunegunn Choi
2016-11-09Fix panic when color is disabled and header lines contain ANSI colorsJunegunn Choi
Close #732
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-10-18Use relative position instead of absolute distance for --tiebreak=endJunegunn Choi
Fix unintuitive result where `*fzf*/install` is ranked higher than `fzf/src/fzf/*fzf*-linux_386` on --tiebreak=end.
2016-09-29Use unicode.IsSpace to cover more whitespace charactersJunegunn Choi
2016-09-29Add support for more ANSI color attributes (#674)Junegunn Choi
Dim, underline, blink, reverse
2016-09-18Revise ranking algorithmJunegunn Choi
2016-08-20Remove Offset slice from Result structJunegunn Choi
2016-08-19Add missing sourcesJunegunn Choi