mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
Fixes #358 ,fixed messages being highlighted when a subword of a word matched a
highlight
This commit is contained in:
parent
f58ee01cf5
commit
633c9fa68b
1 changed files with 10 additions and 1 deletions
|
@ -411,7 +411,16 @@ void TwitchMessageBuilder::parseHighlights()
|
|||
|
||||
if (!blackList.contains(this->ircMessage->nick(), Qt::CaseInsensitive)) {
|
||||
for (const messages::HighlightPhrase &highlight : activeHighlights) {
|
||||
if (this->originalMessage.contains(highlight.key, Qt::CaseInsensitive)) {
|
||||
int index = -1;
|
||||
|
||||
while ((index = this->originalMessage.indexOf(highlight.key, index + 1,
|
||||
Qt::CaseInsensitive)) != -1) {
|
||||
if ((index != 0 && this->originalMessage[index - 1] != ' ') ||
|
||||
(index + highlight.key.length() != this->originalMessage.length() &&
|
||||
this->originalMessage[index + highlight.key.length()] != ' ')) {
|
||||
continue;
|
||||
}
|
||||
|
||||
debug::Log("Highlight because {} contains {}", this->originalMessage,
|
||||
highlight.key);
|
||||
doHighlight = true;
|
||||
|
|
Loading…
Reference in a new issue