Drop last character for basename matching

If the candidate ends with a slash we still look at the previous
component as the basename.
This commit is contained in:
Maxime Coste 2023-11-16 12:59:55 +11:00
parent a42aa1e47e
commit b10a935b8c

View File

@ -136,7 +136,7 @@ RankedMatch::RankedMatch(StringView candidate, StringView query, TestFunc func)
if (res->single_word)
m_flags |= Flags::SingleWord;
if (auto it = find(candidate | reverse(), '/').base();
if (auto it = find(candidate | reverse() | skip(1), '/').base();
it == candidate.begin() or subsequence_match_smart_case({it, candidate.end()}, query))
{
m_flags |= Flags::BaseName;