Don't autocomplete @-mentions mid-word

Now the @ has to follow a space, newline or certain punctuation, or be
at the beginning of the message. This addresses the frequent complaint
that typing an email address e.g. scott@zulip.com is hard, because after
the @, it would try to autocomplete.

(imported from commit 043953be3928b0acf2a4ab2b4dd1a80e1a1aa882)
This commit is contained in:
Scott Feeney 2013-08-01 18:42:39 -04:00
parent 2442edee9e
commit 31bee946be
1 changed files with 6 additions and 0 deletions

View File

@ -289,6 +289,12 @@ exports.initialize = function () {
return false; // No '@', or too far back
}
// Only match if the @ follows a space, various punctuation,
// or is at the beginning of the string.
if (last_at > 0 && "\n\t \"'(){}[]".indexOf(q[last_at-1]) === -1) {
return false;
}
current_token = q.substring(last_at + 1);
if (current_token.length < 1 || current_token.lastIndexOf('*') !== -1) {
return false;