Closed pafcu closed 9 years ago
Space is probably the easiest and most intuitive way to tell it to stop looking (even if it didn't match anything) but I have no complaints if you wanted to allow a space.
The problem is that names can contain spaces. Let's say I have a bunch of friends named Fred, and I want to mention Fred Xavier. So I start by typing "@Fred". The list is long, and the unfortunate Mr. Xavier is at the bottom of the list due to his last name. To reduce the number of matches I continue typing "@Fred X", but suddenly I don't get any suggestions at all. Instead I have to remove some of the text I just typed, and move down the (possibly fairly long list) of Freds. To me it's not intuitive that I have to remove text in order to get more matches (even though the technical reason is perfectly clear).
Autocompleting on the second word results in some unnecessary queries to the backend (because the second word is actually often not part of a name), but for the user it should be a nicer experience.
You don't have to explain - I had a similar issue parsing them on the backend and resolved it basically the same way.
Apparently the issue is more complicated then I expected, because the textcomplete library doesn't like potential matches inside each other, e.g. @Some @Name could be interpreted as a mention to someone called Some @Name or it could be two separate mentions.
This issue was moved to redmatrix/redmatrix#165
Due to the regex used in view/js/autocomplete.js, autocomplete "stops working" if you type a space (only completes on the first word). Should be easy to fix by changing the regex to allow one space.