Commit graph

13 commits

Author SHA1 Message Date
Kegan Dougal
62c378a619 Sort out the mess that is Javascript's \b - Fixes vector-im/vector-web#189
\b is *the worst*. From MDN:

Note: JavaScript's regular expression engine defines a specific set of
characters to be "word" characters. Any character not in that set is considered
a word break. This set of characters is fairly limited: it consists solely of
the Roman alphabet in both upper- and lower-case, decimal digits, and the
underscore character. Accented characters, such as "é" or "ü" are,
unfortunately, treated as word breaks.

We fix this by matching on whitespace instead, but then need to tweak the
replace() code since that bluntly replaces the entire match (which now includes
whitespace). It all works now and I can happily tab-complete non-ascii names.
2015-12-22 17:38:24 +00:00
Kegan Dougal
452c265e6a Implement automatically entering tab complete mode after a short delay
This seems to work. Manually tested for sanity.
2015-12-22 16:49:58 +00:00
Kegan Dougal
e077517faf Ignore more keys when determining if the user is typing
Specifically ignore CTRL, ALT, META, SHIFT, WINDOWS.
2015-12-22 15:13:11 +00:00
Kegan Dougal
e541ddb060 Auto-complete clicked suggestions 2015-12-22 11:14:36 +00:00
Kegan Dougal
0dbb8d5294 Use MemberAvatar to generate image JSX. Split out entries from tab-complete logic 2015-12-22 10:00:30 +00:00
Kegan Dougal
c8aaee46d7 Mark a TODO for timeout handling 2015-12-21 17:58:36 +00:00
Kegan Dougal
ba63b5dfff Add image URLs to TabComplete.Entry objects 2015-12-21 17:28:04 +00:00
Kegan Dougal
4e79c3c4c8 Add allowLooping opt for tab completion. Make peeking work. 2015-12-21 17:16:49 +00:00
Kegan Dougal
ab0a277d94 Rewrite tab-complete logic to allow peeking ahead
This primarily means pre-calculating the list of things we'll be looping over
and then returning matches from this list. Make the regex match be more generic
rather than sorta-kinda-user-id-like-ish.
2015-12-21 16:35:39 +00:00
Kegan Dougal
41d4c1d14e Add TabComplete.Entry so we can render images AND text(!) - Add peek() option, all broken. 2015-12-21 14:34:25 +00:00
Kegan Dougal
400b5196bb Add TabCompleteBar. Hook up display to whether we are currently tab completing. 2015-12-21 14:11:34 +00:00
Kegan Dougal
26dc3cc553 Push up instantiation of TabComplete to RoomView
RoomView is the parent component which creates MessageComposer AND the status
bar. By making RoomView instantiate TabComplete we can scope instances
correctly rather than relying on singleton behaviour through dispatches. This
also makes communication between status bar and the MessageComposer infinitely
easier since they are now sharing the same TabComplete object.
2015-12-21 10:59:10 +00:00
Kegan Dougal
c6d02b2c26 Move tab-complete logic out from MessageComposer
Moved to a `TabComplete` class. Make it more generic (list of strings rather
than RoomMembers) and sort the member list by last_active_ago. Everything still
seems to work.
2015-12-21 10:38:37 +00:00