summaryrefslogtreecommitdiff
path: root/src/ranked_match.cc
AgeCommit message (Collapse)Author
2025-04-02Reduce include creepMaxime Coste
2025-04-02Tweak ranked match behaviour to consider the number of full wordsMaxime Coste
Tracking the number of query words that appear as full words in the candidate seems to fix a few cases where the existing fuzzy matching algorithm was not great. I have been running with this for a while and did not notice any annoyances, the whole RankedMatch code probably deserves more attention but this seems to go in the right direction.
2024-08-12Reduce headers dependency graphMaxime Coste
Move more code into the implementation files to reduce the amount of code pulled by headers.
2024-02-12Use unicode is_word/to_{lower/upper} function in ranked matchMaxime Coste
2023-12-12Merge remote-tracking branch 'krobelus/prefer-input-order-over-alphabet'Maxime Coste
2023-12-04Fix basename prefix flag to use smartcase eqMaxime Coste
2023-12-02ranked match: prefer input order over alphabetical order for user-specified ↵Johannes Altmanninger
completions When using either of set-option g completers option=my_option prompt -shell-script-candidates ... While the search text is empty, the completions will be sorted alphabetically. This is bad because it means the most important entries are not listed first, making them harder to select or even spot. Let's apply input order before resorting to sorting alphabetically. In theory there is a more elegant solution: sort candidates (except if they're user input) before passing them to RankedMatch, and then always use stable sort. However that doesn't work because we use a heap which doesn't support stable sort. Closes #1709, #4813
2023-12-02Fix single word detection when query is not single wordMaxime Coste
2023-11-23Only set Prefix in RankedMatch if the full query matchesMaxime Coste
2023-11-16Drop last character for basename matchingMaxime Coste
If the candidate ends with a slash we still look at the previous component as the basename.
2023-11-15Slight cleanup of RankedMatch codeMaxime Coste
2023-11-15Refactor fuzzy matcher ranking furtherMaxime Coste
Remove FirstCharMatch which does not impact any of the test cases and explicitely detect paths by using a BaseName flag when we match the basename of the path.
2023-11-11Fix SingleWord handling in RankedMatchMaxime Coste
subsequence_match_smart_case does not necessarily find the word, but we then check for a contiguous match in which case, if the query is a word, we also have a single word match.
2022-11-19Accept "cd dir/" again instead of using a subdirectoryJohannes Altmanninger
Commit 69053d962 (Use menu behavior when completing change-directory, 2022-07-19) made ":cd dir/" actually run ":cd dir/first-subdir", which can be surprising. This is usually irrelevant because you rarely type the trailing slash. However it does happen after correcting an error with `<backspace>` and friends. For for example, :cd d<tab>/f<backspace> results in :cd dir/ We should probably fix user expectations here. Do this by adding "dir/" as valid completion. This requires us to allow empty candidates in "RankedMatch" but there's no harm in that. This means we need to filter out empty completions from shell-script-candidates elsewhere. Alternative fix: we could revert 69053d962. This would remove the convenient menu behavior but that wouldn't be a huge deal. Fixes #4775
2021-12-14Bug fix: use only iswlower() in RankedMatch::is_word_boundary()Sidharth Kshatriya
2019-09-07Rank a word-boundary after a non-word-boundaryJean-Louis Fuchs
2018-03-15RankedMatch: Do not compare word boundary match count on single word matchesMaxime Coste
As the computation of word boundary matches is separate from the actual subsequence matching, we sometimes have candidate that match as a single word while still having multiple word boundary matches. For example, with query "expresins", candidate "expressionism's" will match as single word ("expressins" is a subsequence of "expressionism"), and will have two word boundaries match (it does match the last "s", which is considered as a separate word). This should not be taken into account when compared against candidate "expresions", which should be considered a better match. Fixes #1925
2017-12-06RankedMatch: Make punctuation ordered *before* alphanumeric charactersMaxime Coste
2017-10-10Move all non-core string code to string_utils.{hh,cc}Maxime Coste
2017-07-19Make non smart case full match better than smart case full matchMaxime Coste
2017-07-19Use smart case matching for contiguous/prefix/fullmatch detectionMaxime Coste
Fixes #1498
2017-06-04Change RankedMatch ordering to favor `/` charactersMaxime Coste
This will improve matching of filenames, as 'foo/' will be sorted before 'foo-bar' due to `/` coming before `-` in the new ordering (it comes after in ascii/unicode order). Fixes #1395
2017-03-15Migrate WithBitOps template specialization to with_bit_ops functionMaxime Coste
This way we dont depend on knowing the base template to enable bit ops on an enum type.
2017-01-31Tweak ranked match orderingMaxime Coste
2017-01-30Warning fix in ranked_match.ccMaxime Coste
2017-01-29Fix infinite loop when comparing RankedMatches containing invalid utf8Maxime Coste
If we had a word containing some invalid utf8, like a wrong sequence of continuation bytes, we would infinitely loop back to the previous valid character start. Fixes #1157
2017-01-29Use iswlower instead of islowerMaxime Coste
islower can crash with big codepoints, and is incorrect anyway.
2016-11-28Cleanup include dependencies a bitMaxime Coste
2016-11-22Fix literal type that must be 64 bitsMaxime Coste
2016-11-14Tweak RankedMatch behaviour and fix bug in its comparison functionMaxime Coste
casting TestableFlag<T> to UnderlyingType<T> was going through bool conversion... Not sure how things worked earlier.
2016-09-30Tweak ranked match comparison, give contiguous matches an edgeMaxime Coste
2016-09-26Tweak RankedMatch logic, prioritize matches that are in a single wordMaxime Coste
2016-08-30Only decode utf8 when strictly necessary in RankedMatch::operator<Maxime Coste
2016-08-30Tweak RankedMatch, compare max match index instead of match indices sumMaxime Coste
2016-08-29Use flags and bit operations instead of bools in RankedMatchMaxime Coste
full match is now the most important flag for comparison.
2016-05-20Fix RankedMatch ordering where 'a < a' was trueMaxime Coste
Fixes #679
2016-05-19Go back to libc locale and use c_regex_traitsMaxime Coste
Unfortunately, cygwin does not support c++ locales.
2016-05-17Fix RankedMatch::operator< with matching prefix candidatesMaxime Coste
2016-05-11Use C++ locale based functions instead of the libc onesMaxime Coste
2016-04-04Tweak RankedMatch behaviourMaxime Coste
2016-04-04Give priority to lower case in RankedMatchMaxime Coste
2016-03-28Tweak subsequence_match_smart_caseMaxime Coste
2016-03-28Use manual lexicographic comparison in RankedMatch::operator<Maxime Coste
2016-03-25Move UsedLetters with RankedMatchMaxime Coste
2016-03-24Tweak implementation of subsequence_match_smart_caseMaxime Coste
Remove use of utf8 iterators and use directly utf8 functions
2016-03-24Fix uninitialized value in RankedMatchMaxime Coste
2016-03-02Tweak RankedMatch ordering, give priority to prefix matchesMaxime Coste
2016-02-28Take subsequence matches index when sorting RankedMatchMaxime Coste
2016-02-22Tweak RankedMatch::operator<Maxime Coste
2016-02-17Fix count_word_boundaries_matchMaxime Coste