summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2024-02-12 07:50:04 +1100
committerMaxime Coste <mawww@kakoune.org>2024-02-12 07:50:04 +1100
commite0c7a34bc14a62da9c6cc9d2c3a53e4a14beb03f (patch)
treea28b77c4369a0a03ed27a53e439b2272834ba46e /src
parentbd91a255e49c81e3d20c43359facac95191e041a (diff)
Use unicode is_word/to_{lower/upper} function in ranked match
Diffstat (limited to 'src')
-rw-r--r--src/ranked_match.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/ranked_match.cc b/src/ranked_match.cc
index 0ace0a14..a13decdf 100644
--- a/src/ranked_match.cc
+++ b/src/ranked_match.cc
@@ -45,8 +45,8 @@ static int count_word_boundaries_match(StringView candidate, StringView query)
{
const Codepoint c = *it;
const bool is_word_boundary = prev == 0 or
- (!iswalnum((wchar_t)prev) and iswalnum((wchar_t)c)) or
- (iswlower((wchar_t)prev) and iswupper((wchar_t)c));
+ (!is_word(prev, {}) and is_word(c, {})) or
+ (is_lower(prev) and is_upper(c));
prev = c;
if (not is_word_boundary)
@@ -56,7 +56,7 @@ static int count_word_boundaries_match(StringView candidate, StringView query)
for (auto qit = query_it; qit != query.end(); ++qit)
{
const Codepoint qc = *qit;
- if (qc == (iswlower((wchar_t)qc) ? lc : c))
+ if (qc == (is_lower(qc) ? lc : c))
{
++count;
query_it = qit+1;
@@ -71,7 +71,7 @@ static int count_word_boundaries_match(StringView candidate, StringView query)
static bool smartcase_eq(Codepoint candidate, Codepoint query)
{
- return query == (iswlower((wchar_t)query) ? to_lower(candidate) : candidate);
+ return query == (is_lower(query) ? to_lower(candidate) : candidate);
}
struct SubseqRes