highlight improvements
* only highlight if surrounded by whitespaces (or trailing ': ')
+ case-insensitive
--- 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)