Is there any reason @mentions don’t autocomplete using the full name if it’s not in English (specifically, if it’s in Hebrew)? I plan to create a Hebrew forum mostly using full names, and having to switch to English, and remember the username, just to mention somebody is a real pain.
(If it can be fixed and isn’t too complicated, I will be glad to contribute a patch.)
I don’t think it has something to do with RTL - I changed the interface language to English (so everything is LTR) and it didn’t complete just the same.
I have read in several places that this autocomplete should also complete full names, not only usernames. The full name is Hebrew, the username contains only latin characters.
I think I have found the source of the problem. In jsapp/lib/user-search.js.es6 line 91 you have:
// TODO site setting for allowed regex in username
if (term.match(/[^a-zA-Z0-9_\.]/)) {
I added א-ת to the regex to include Hebrew characters, and it worked! Now, this is fine by me, but perhaps a more general solution should be used – in fact, I tried removing the entire if block, and it seems to work fine – I can even search a display name that includes a space (I don’t have to use an underscore), so I can just type “@jeff at” and get it completed to @codinghorror and I don’t need to type @jeff_at, which I think most users wouldn’t have tried at all.
I’m not sure that it was wise to remove the entire regex. Shouldn’t we at least stop the autocomplete when a space is entered?
With this change I need to explicitly select an entry from the autocomplete dialog with the enter key.
Otherwise the autocomplete dialog shows up when I write someones name followed by a space even if the mentioned name matches an existing user.
For example @sam followed by a space results in this:
Either stop matching when a space is entered or don’t show the autocomplete dialog when there’s already an exact match on the name and a space was entered.
Are you sure the autocomplete should stop on any space? The new (reverted) behaviour lets you mention @codinghorror by typing @jeff atwood and pressing Enter, but would still allow you to mention @jeff by typing “@jeff how are you”. The only thing slightly peculiar is that the autocomplete list remains open after you typed @jeff and a space. I think the list wouldn’t even be shown to most users, as they won’t pause after the space. And if the list does get shown, they can just ignore it and continue typing.
The advantage is that you can use autocomplete to find the user you want by his full name, even if there are multiple users with the same first name. Indeed, you can do this anyway by using an underscore, but I guess many users won’t discover that.
It is a bit indeterminate since you can match username (ascii, a-z, no spaces) and full name (unicode, spaces, etc) in the same mechanism – so I can support making sure unicode character ranges are the regex – but matching space is super undesirable.
Or maybe the regex should be “hit a space or end of line”.
Can you elaborate on what’s the problem with that? As I said, the only thing that I see is that it’s a bit weird that if you type @jeff and a space, and then pause, the list remains open. But I don’t see any functionality problem with that. I think this is a small price to pay for being able to search for users by their full name (in case they have a common first name).