]> git.0d.be Git - empathy.git/commit
Use /\b<nickname>\b/ to decide whether to highlight
authorWill Thompson <will@willthompson.co.uk>
Wed, 18 Jan 2012 15:41:07 +0000 (15:41 +0000)
committerWill Thompson <will@willthompson.co.uk>
Wed, 18 Jan 2012 17:47:21 +0000 (17:47 +0000)
commitaded85c91fb409bafb06492ddb85aa1224178d4c
tree374c7de2868580c498358ed49e7ec50ce6e5e51a
parent449c56b28d41ddbb13e8d206b9d1fbabca7e2ec6
Use /\b<nickname>\b/ to decide whether to highlight

The current highlighting code finds the first occurrence of the
nickname, then checks whether the characters before or after are a
space, a comma, a colon or a full stop (or the start or end of the
string). This means that someone saying “no! That's wjt’s coffee!”
didn’t highlight me, because the apostrophe isn't in the whitelist. It
also means that saying “borrow some Sudafed from daf” would not
highlight daf, since the first match is in the middle of a word.

We’re trying to check whether the nickname occurs as a complete word
within the message. The regex metacharacter \b matches word boundaries,
so /\b<nickname>\b/ is what we actually want. It gets the above cases
right, including Unicode punctuation.

https://bugzilla.gnome.org/show_bug.cgi?id=591667
libempathy/empathy-message.c