Only set Prefix in RankedMatch if the full query matches
This commit is contained in:
parent
cad2f6fb66
commit
990e92a5f3
|
@ -140,7 +140,8 @@ RankedMatch::RankedMatch(StringView candidate, StringView query, TestFunc func)
|
||||||
it == candidate.begin() or subsequence_match_smart_case({it, candidate.end()}, query))
|
it == candidate.begin() or subsequence_match_smart_case({it, candidate.end()}, query))
|
||||||
{
|
{
|
||||||
m_flags |= Flags::BaseName;
|
m_flags |= Flags::BaseName;
|
||||||
if (*it == query[0])
|
if ((candidate.end() - it) >= query.length() and
|
||||||
|
std::equal(query.begin(), query.end(), it))
|
||||||
m_flags |= Flags::Prefix;
|
m_flags |= Flags::Prefix;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -277,6 +278,7 @@ UnitTest test_ranked_match{[] {
|
||||||
kak_assert(preferred("foo_b", "bar/bar_qux/foo_bar.baz", "foo/test_foo_bar.baz"));
|
kak_assert(preferred("foo_b", "bar/bar_qux/foo_bar.baz", "foo/test_foo_bar.baz"));
|
||||||
kak_assert(preferred("foo_bar", "bar/foo_bar.baz", "foo_bar/qux.baz"));
|
kak_assert(preferred("foo_bar", "bar/foo_bar.baz", "foo_bar/qux.baz"));
|
||||||
kak_assert(preferred("fb", "foo_bar/", "foo.bar"));
|
kak_assert(preferred("fb", "foo_bar/", "foo.bar"));
|
||||||
|
kak_assert(preferred("foo_bar", "test_foo_bar", "foo_test_bar"));
|
||||||
}};
|
}};
|
||||||
|
|
||||||
UnitTest test_used_letters{[]()
|
UnitTest test_used_letters{[]()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user