highlight improvements
authorsheepluva
Sun, 23 Oct 2011 22:47:59 +0200
changeset 6193 4f234aa06182
parent 6192 7c34bf4fbb54
child 6194 32b7e0ece99a
highlight improvements * only highlight if surrounded by whitespaces (or trailing ': ') + case-insensitive
QTfrontend/ui/widget/chatwidget.cpp
--- a/QTfrontend/ui/widget/chatwidget.cpp	Sun Oct 23 14:44:19 2011 -0400
+++ b/QTfrontend/ui/widget/chatwidget.cpp	Sun Oct 23 22:47:59 2011 +0200
@@ -466,7 +466,14 @@
                 cssClass = "msg_FriendChat";
     }
 
-    addLine(cssClass, formattedStr, (!nick.isEmpty()) && str.contains(m_userNick));
+    bool isHL = (!nick.isEmpty() &&
+                (nick != m_userNick) &&
+                str.toLower().contains(
+                        QRegExp(QString("^(.* )?%1(( |: ).*)?$").
+                            arg(QRegExp::escape(m_userNick).toLower())))
+                );
+
+    addLine(cssClass, formattedStr, isHL);
 }
 
 void HWChatWidget::addLine(const QString & cssClass, QString line, bool isHighlight)