summaryrefslogtreecommitdiff
path: root/src/pattern.go
AgeCommit message (Collapse)Author
2025-02-12Allow suffix match on --nth with custom --delimiterJunegunn Choi
When --nth is used with a custom --delimiter, the last delimiter was included in the search scope, forcing you to write the delimiter in a suffix-match query. This commit removes the last delimiter from the search scope. # No need to write 'bar,$' echo foo,bar,baz | fzf --delimiter , --nth 2 --filter 'bar$' This can be seen as a breaking change, but I'm gonna say it's a bug fix. Fix #3983
2025-02-09Add 'exclude' action for excluding current/selected items from the result ↵Junegunn Choi
(#4231) Close #4185
2025-02-09Add --accept-nth option to transform the outputJunegunn Choi
This option can be used to replace a sed or awk in the post-processing step. ps -ef | fzf --multi --header-lines 1 | awk '{print $2}' ps -ef | fzf --multi --header-lines 1 --accept-nth 2 This may not be a very "Unix-y" thing to do, so I've always felt that fzf shouldn't have such an option, but I've finally changed my mind because: * fzf can be configured with a custom delimiter that is a fixed string or a regular expression. * In such cases, you'd need to repeat the delimiter again in the post-processing step. * Also, tools like awk or sed may interpret a regular expression differently, causing mismatches. You can still use sed, cut, or awk if you prefer. Close #3987 Close #1323
2025-02-06Fix nth highlightingJunegunn Choi
Fix #4222
2025-01-13Simplify nth comparison when reusing transformed tokensJunegunn Choi
2025-01-13Fix change-nthJunegunn Choi
* Proper clean-up of caches * Force rerender list after the action
2024-08-29Require quotes on both sides for boundary matching even in --exact modeJunegunn Choi
Only requiring '-suffix in --exact mode is confusing and not straightforward. Requiring '-prefix in --exact mode means that the users can experience unintended mode switches while typing. e.g. 'it -> fuzzy (many results) 'it' -> boundary (few results) 'it's -> fuzzy (many results) However, user who intends to input a boundary query should not be interested in the intermediate results, and the number of matches decreases as she types, so it should be okay. On the other hand, user who does intend to type "it's" will be surprised by the sudden decrease of the match count, but eventually get the right result.
2024-08-29Implement exact-boundary match typeJunegunn Choi
Close #3963
2024-05-18chore: use strings.ReplaceAll (#3801)Zhizhen He
2024-05-07Refactor the code so that fzf can be used as a library (#3769)Junegunn Choi
2024-03-05Remove duplicate codeonee-only
2022-08-03Fix incorrect ordering of `--tiebreak=chunk`Junegunn Choi
2021-02-28Check gofmt in `make test`Junegunn Choi
2020-07-28Smart match of accented charactersJunegunn Choi
Fix #1618
2018-12-19Inverse-only matches should not reorder the remaining resultsJunegunn Choi
Fix #1458
2018-03-13Make fzf pass go vetRyan Boehning
Add String() methods to types, so they can be printed with %s. Change some %s format specifiers to %v, when the default string representation is good enough. In Go 1.10, `go test` triggers a parallel `go vet`. So this also makes fzf pass `go test`. Close #1236 Close #1219
2017-08-20Pass util.Chars by pointerJunegunn Choi
2017-08-15Remove special nilItemJunegunn Choi
2017-08-11Disallow escaping of meta characters except for spacesJunegunn Choi
https://github.com/junegunn/fzf/issues/444#issuecomment-321719604
2017-08-11Treat | as proper query when it can't be an OR operatorJunegunn Choi
2017-08-10Treat $ as proper search queryJunegunn Choi
When $ is the leading character in a query, it's probably not meant to be an anchor.
2017-08-10Build cache key for a pattern only onceJunegunn Choi
2017-08-10Fix escaping of meta characters after ' or ! prefixJunegunn Choi
https://github.com/junegunn/fzf/issues/444#issuecomment-321432803
2017-08-09Allow escaping term starting with |Junegunn Choi
Close #444
2017-08-09Allow escaping meta characters with backslashesJunegunn Choi
One can escape meta characters in extended-search mode with backslashes. Prefixes: \' \! \^ Suffix: \$ Term separator: \<SPACE> To keep things simple, we are not going to support escaping of escaped sequences (e.g. \\') for matching them literally. Since this is a breaking change, we will bump the minor version. Close #444
2017-08-08Fix invalid cache lookupsJunegunn Choi
2017-08-01Inline function calls in a tight loopJunegunn Choi
Manually inline function calls in a tight loop as Go compiler does not inline non-leaf functions. It is observed that this unpleasant code change resulted up to 10% performance improvement.
2017-07-20Avoid unconditionally storsing input as runesJunegunn Choi
When --with-nth is used, fzf used to preprocess each line and store the result as rune array, which was wasteful if the line only contains ascii characters.
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-07-16Refactor cache lookupJunegunn Choi
- Remove multiple mutex locks in partial cache lookup - Simplify return values
2017-07-16Remove pointer indirection by changing Chunk definitionJunegunn 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-01Fix caching scheme when --exact is set and '-prefix is usedJunegunn Choi
2017-01-09Normalize pattern string before passing it to Algo functionJunegunn Choi
2017-01-09Add --normalize option to normalize latin script charactersJunegunn Choi
Close #790
2016-10-04Use exact match by default for inverse search termJunegunn Choi
This is a breaking change, but I believe it makes much more sense. It is almost impossible to predict which entries will be filtered out due to a fuzzy inverse term. You can still perform inverse-fuzzy-match by prepending `!'` to the term. | Token | Match type | Description | | -------- | -------------------------- | --------------------------------- | | `sbtrkt` | fuzzy-match | Items that match `sbtrkt` | | `^music` | prefix-exact-match | Items that start with `music` | | `.mp3$` | suffix-exact-match | Items that end with `.mp3` | | `'wild` | exact-match (quoted) | Items that include `wild` | | `!fire` | inverse-exact-match | Items that do not include `fire` | | `!.mp3$` | inverse-suffix-exact-match | Items that do not end with `.mp3` |
2016-09-18Revise ranking algorithmJunegunn Choi
2016-08-20No need to cache the result in filtering mode (--filter)Junegunn Choi
2016-08-20Remove Offset slice from Result structJunegunn Choi
2016-08-19Micro-optimizationsJunegunn Choi
- Make structs smaller - Introduce Result struct and use it to represent matched items instead of reusing Item struct for that purpose - Avoid unnecessary memory allocation - Avoid growing slice from the initial capacity - Code cleanup
2016-08-14LintJunegunn Choi
2016-08-14[perf] Avoid allocating rune array for ascii stringJunegunn Choi
In the best case (all ascii), this reduces the memory footprint by 60% and the response time by 15% to 20%. In the worst case (every line has non-ascii characters), 3 to 4% overhead is observed.
2016-04-24Fix incorrect cache reference in --exact mode (#547)Junegunn Choi
When we prepend a single quote to our query in --exact mode, we are not supposed to limit the scope of the new search to the previous exact-match result.
2016-04-16Enhanced ranking algorithmJunegunn Choi
Based on the patch by Matt Westcott (@mjwestcott). But with a more conservative approach: - Does not use linearly increasing penalties; It is agreed upon that we should prefer matching characters at the beginnings of the words, but it's not always clear that the relevance is inversely proportional to the distance from the beginning. - The approach here is more conservative in that the bonus is never large enough to override the matchlen, so it can be thought of as the first implicit tiebreak criterion. - One may argue the change breaks the contract of --tiebreak, but the judgement depends on the definition of "tie".
2016-01-14Simplify Item structureJunegunn Choi
This commit compensates for the performance overhead from the extended tiebreak option.
2016-01-13Accept comma-separated list of sort criteriaJunegunn Choi
2015-11-10Fix compatibility issues with OR operator and inverse termsJunegunn Choi
2015-11-09Add OR operatorJunegunn Choi
Close #412
2015-11-03Make --extended defaultJunegunn Choi
Close #400