Commit Graph

39 Commits

Author SHA1 Message Date
Maxime Coste
08df409a53 RankedMatch: Do not compare word boundary match count on single word matches
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
2018-03-15 23:20:03 +11:00
Maxime Coste
86fcc55e53 RankedMatch: Make punctuation ordered *before* alphanumeric characters 2017-12-06 13:58:34 +08:00
Maxime Coste
6ada6e6d77 Move all non-core string code to string_utils.{hh,cc} 2017-10-10 10:52:32 +08:00
Maxime Coste
ec1824d3c3 Make non smart case full match better than smart case full match 2017-07-19 20:18:47 +02:00
Maxime Coste
016a50f213 Use smart case matching for contiguous/prefix/fullmatch detection
Fixes #1498
2017-07-19 20:16:28 +02:00
Maxime Coste
6101138606 Change RankedMatch ordering to favor / characters
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-06-04 08:27:53 +01:00
Maxime Coste
db9b863222 Migrate WithBitOps template specialization to with_bit_ops function
This way we dont depend on knowing the base template to enable bit ops
on an enum type.
2017-03-15 18:00:58 +00:00
Maxime Coste
6a0354a597 Tweak ranked match ordering 2017-01-31 22:30:23 +00:00
Maxime Coste
9d09d14d99 Warning fix in ranked_match.cc 2017-01-30 11:22:14 +00:00
Maxime Coste
632e05d830 Fix infinite loop when comparing RankedMatches containing invalid utf8
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-29 23:50:33 +00:00
Maxime Coste
cb395d39f8 Use iswlower instead of islower
islower can crash with big codepoints, and is incorrect anyway.
2017-01-29 23:37:10 +00:00
Maxime Coste
12856066b1 Cleanup include dependencies a bit 2016-11-28 23:58:08 +00:00
Maxime Coste
3f3ed0b333 Fix literal type that must be 64 bits 2016-11-22 22:20:30 +00:00
Maxime Coste
6d79ade019 Tweak RankedMatch behaviour and fix bug in its comparison function
casting TestableFlag<T> to UnderlyingType<T> was going through bool
conversion... Not sure how things worked earlier.
2016-11-14 19:39:35 +00:00
Maxime Coste
dc735450a8 Tweak ranked match comparison, give contiguous matches an edge 2016-09-30 22:13:01 +01:00
Maxime Coste
b5450aa375 Tweak RankedMatch logic, prioritize matches that are in a single word 2016-09-26 21:54:39 +01:00
Maxime Coste
f52f5f7c53 Only decode utf8 when strictly necessary in RankedMatch::operator< 2016-08-30 00:51:21 +01:00
Maxime Coste
2b631837d8 Tweak RankedMatch, compare max match index instead of match indices sum 2016-08-30 00:30:15 +01:00
Maxime Coste
cbe38b2f96 Use flags and bit operations instead of bools in RankedMatch
full match is now the most important flag for comparison.
2016-08-29 23:56:22 +01:00
Maxime Coste
fa35330b42 Fix RankedMatch ordering where 'a < a' was true
Fixes #679
2016-05-20 18:42:01 +01:00
Maxime Coste
1834a67b87 Go back to libc locale and use c_regex_traits
Unfortunately, cygwin does not support c++ locales.
2016-05-19 21:45:23 +01:00
Maxime Coste
49e674fe55 Fix RankedMatch::operator< with matching prefix candidates 2016-05-17 19:40:36 +01:00
Maxime Coste
84f62e6ff2 Use C++ locale based functions instead of the libc ones 2016-05-11 09:49:45 +01:00
Maxime Coste
989d64abd4 Tweak RankedMatch behaviour 2016-04-04 13:42:58 +01:00
Maxime Coste
0478a8f11a Give priority to lower case in RankedMatch 2016-04-04 13:42:58 +01:00
Maxime Coste
94f4531bc8 Tweak subsequence_match_smart_case 2016-03-28 15:18:15 +01:00
Maxime Coste
2a9875bd58 Use manual lexicographic comparison in RankedMatch::operator< 2016-03-28 14:44:49 +01:00
Maxime Coste
c756f8f124 Move UsedLetters with RankedMatch 2016-03-25 20:38:27 +00:00
Maxime Coste
87704227ad Tweak implementation of subsequence_match_smart_case
Remove use of utf8 iterators and use directly utf8 functions
2016-03-24 23:45:56 +00:00
Maxime Coste
ccb53eca42 Fix uninitialized value in RankedMatch 2016-03-24 22:04:56 +00:00
Maxime Coste
761d316af6 Tweak RankedMatch ordering, give priority to prefix matches 2016-03-02 13:30:54 +00:00
Maxime Coste
9b70346a00 Take subsequence matches index when sorting RankedMatch 2016-02-28 23:05:51 +00:00
Maxime Coste
53821be7cc Tweak RankedMatch::operator< 2016-02-22 23:07:29 +00:00
Maxime Coste
85a8a0c26d Fix count_word_boundaries_match 2016-02-17 23:05:08 +00:00
Maxime Coste
892c3647e4 Fix to_lower/to_upper handling to correctly support non unicode chars
require a proper unicode locale setup on the system
Fixes #94
2015-11-11 00:21:20 +00:00
Maxime Coste
2bf44b6b49 Make word insert completion work better with unicode char 2015-10-30 13:57:46 +00:00
Maxime Coste
24043bbffe Use an heuristic based match ranking algorithm inspired by what YouCompleteMe does 2015-10-29 13:36:30 +00:00
Maxime Coste
89d22f3335 Move more logic into RankedMatch 2015-10-27 21:25:18 +00:00
Maxime Coste
c77cb7c777 Extract WordDB::RankedWord as RankedMatch in its own file 2015-10-22 19:49:08 +01:00