From 5b51ec99f713bcc4ad2708b54a002f094aef5de8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20M=C3=BCller?= Date: Fri, 14 Jul 2023 18:05:44 +0200 Subject: [PATCH] Fix incorrect server browser filter highlighting By calculating the correct length of the string matched in the haystack using the added `end` parameter of `str_utf8_find_nocase`. --- src/game/client/components/menus_browser.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/game/client/components/menus_browser.cpp b/src/game/client/components/menus_browser.cpp index 414034a63f0..7e36962e23c 100644 --- a/src/game/client/components/menus_browser.cpp +++ b/src/game/client/components/menus_browser.cpp @@ -1320,7 +1320,10 @@ bool CMenus::PrintHighlighted(const char *pName, F &&PrintFn) } else { - pFilteredStr = str_utf8_find_nocase(pName, aFilterStr); + const char *pFilteredStrEnd; + pFilteredStr = str_utf8_find_nocase(pName, aFilterStr, &pFilteredStrEnd); + if(pFilteredStr != nullptr && pFilteredStrEnd != nullptr) + FilterLen = pFilteredStrEnd - pFilteredStr; } if(pFilteredStr) {