[core] Only include branch in search highlight range on iOS

Can be removed when other platforms incorporate branch in UI

Signed-off-by: eisa01 <eisa01@gmail.com>
This commit is contained in:
eisa01
2025-10-23 16:39:50 +02:00
committed by x7z4w
parent 042d497a5e
commit 7afb1df917

View File

@@ -1,4 +1,5 @@
#include "search/highlighting.hpp"
#include "std/target_os.hpp"
namespace search
{
@@ -51,12 +52,11 @@ void HighlightResult(QueryTokens const & tokens, strings::UniString const & pref
std::string titleForHighlighting = res.GetString();
std::string const & branch = res.GetBranch();
// If we have a branch that is not already in the title, create combined string for highlighting
// This matches the iOS UI behavior where branch is appended as " branchText"
// On iOS we append branch text to the title for highlighting if it's not already present.
#if defined(OMIM_OS_IPHONE)
if (!branch.empty() && titleForHighlighting.find(branch) == std::string::npos)
{
titleForHighlighting += " " + branch;
}
#endif
SearchStringTokensIntersectionRanges(
titleForHighlighting, beg, end, [&](std::pair<uint16_t, uint16_t> const & range) { res.AddHighlightRange(range); });