1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-11-29 10:02:57 +03:00

Fix basename prefix flag to use smartcase eq

This commit is contained in:
Maxime Coste 2023-12-04 19:22:32 +11:00
parent 84ecd41da1
commit 7f49395cf9

View File

@ -143,7 +143,8 @@ RankedMatch::RankedMatch(StringView candidate, StringView query, TestFunc func)
{
m_flags |= Flags::BaseName;
if ((candidate.end() - it) >= query.length() and
std::equal(query.begin(), query.end(), it))
std::equal(Utf8It{query.begin(), query}, Utf8It{query.end(), query}, Utf8It{it, candidate},
[](Codepoint query, Codepoint candidate) { return smartcase_eq(candidate, query); }))
m_flags |= Flags::Prefix;
}
@ -282,6 +283,7 @@ UnitTest test_ranked_match{[] {
kak_assert(preferred("fb", "foo_bar/", "foo.bar"));
kak_assert(preferred("foo_bar", "test_foo_bar", "foo_test_bar"));
kak_assert(preferred("rm.cc", "src/ranked_match.cc", "test/README.asciidoc"));
kak_assert(preferred("luaremote", "src/script/LuaRemote.cpp", "tests/TestLuaRemote.cpp"));
}};
UnitTest test_used_letters{[]()