[core] Include branch in highlighting

Signed-off-by: eisa01 <eisa01@gmail.com>
This commit is contained in:
eisa01
2025-08-27 21:27:29 +02:00
committed by Konstantin Pastbin
parent 47b18e7753
commit 3d8a1eddc7

View File

@@ -47,9 +47,19 @@ void HighlightResult(QueryTokens const & tokens, strings::UniString const & pref
CombinedIter beg(tokens.begin(), tokens.end(), prefix.empty() ? nullptr : &prefix); CombinedIter beg(tokens.begin(), tokens.end(), prefix.empty() ? nullptr : &prefix);
CombinedIter end(tokens.end() /* cur */, tokens.end() /* end */, nullptr); CombinedIter end(tokens.end() /* cur */, tokens.end() /* end */, nullptr);
// Highlight Title // Highlight Title (potentially including branch)
std::string titleForHighlighting = res.GetString();
std::string const & branch = res.GetBranch();
// If we have a branch, create combined string for highlighting
// This matches the iOS UI behavior where branch is appended as " branchText"
if (!branch.empty())
{
titleForHighlighting += " " + branch;
}
SearchStringTokensIntersectionRanges( SearchStringTokensIntersectionRanges(
res.GetString(), beg, end, [&](std::pair<uint16_t, uint16_t> const & range) { res.AddHighlightRange(range); }); titleForHighlighting, beg, end, [&](std::pair<uint16_t, uint16_t> const & range) { res.AddHighlightRange(range); });
// Highlight description. // Highlight description.
SearchStringTokensIntersectionRanges(res.GetAddress(), beg, end, [&](std::pair<uint16_t, uint16_t> const & range) SearchStringTokensIntersectionRanges(res.GetAddress(), beg, end, [&](std::pair<uint16_t, uint16_t> const & range)