Merge pull request #8963 from ChillerDragon/pr_fix_hilite

Fix name in chat not being highlighted (Closed #2190)
This commit is contained in:
Dennis Felsing 2024-09-16 07:35:48 +00:00 committed by GitHub
commit ce245f479a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -552,14 +552,16 @@ void CChat::OnMessage(int MsgType, void *pRawMsg)
bool CChat::LineShouldHighlight(const char *pLine, const char *pName)
{
const char *pHL = str_utf8_find_nocase(pLine, pName);
const char *pHit = str_utf8_find_nocase(pLine, pName);
if(pHL)
while(pHit)
{
int Length = str_length(pName);
if(Length > 0 && (pLine == pHL || pHL[-1] == ' ') && (pHL[Length] == 0 || pHL[Length] == ' ' || pHL[Length] == '.' || pHL[Length] == '!' || pHL[Length] == ',' || pHL[Length] == '?' || pHL[Length] == ':'))
if(Length > 0 && (pLine == pHit || pHit[-1] == ' ') && (pHit[Length] == 0 || pHit[Length] == ' ' || pHit[Length] == '.' || pHit[Length] == '!' || pHit[Length] == ',' || pHit[Length] == '?' || pHit[Length] == ':'))
return true;
pHit = str_utf8_find_nocase(pHit + 1, pName);
}
return false;