mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-19 13:03:36 +00:00
[core] Include branch in highlighting
Signed-off-by: eisa01 <eisa01@gmail.com>
This commit is contained in:
committed by
Konstantin Pastbin
parent
47b18e7753
commit
3d8a1eddc7
@@ -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)
|
||||||
|
|||||||
Reference in New Issue
Block a user