Commit Graph

26 Commits (2e772e2f19d18ae4aeb6c8d56fc79c90fde74b0e)

Author SHA1 Message Date
Matthew Hodgson 42479cf011 PR feedback 2016-03-17 16:46:54 +00:00
Matthew Hodgson 4a90f262c6 fix zero length tab complete behaviour 2016-03-17 15:34:40 +00:00
Matthew Hodgson e7ec6166fa allow tab-complete to start from a blank text-input. this lets us autocomplete based on the most recently active users in a room, even if we can't spell the first char of their name. it does break tab-complete for accessibility, but that was broken anyway. 2016-03-16 23:11:07 +00:00
Kegan Dougal b67131f0c8 Add a Command class; add Entry.getFillText()
getFillText() serves to decouple the text displayed in the auto-complete list
via getText() and the text actually filled into the box via getFillText(). This
allows us to display command + args on the list but only fill the command part.

A Command class has been added to provide some structure when extracting the
command name and args. Manually tested and it works.
2016-01-14 14:39:58 +00:00
Kegan Dougal 864d10f412 Make individual Entrys responsible for determining suffixes
This makes it cleaner as CommandEntry always wants a space, but MemberEntry
wants a space or ": " depending on if it is the first word or not.
2016-01-14 11:39:24 +00:00
Kegan Dougal 53f31e49da Implement tab-complete for slash commands
This needed a new interface function `getOverrideSuffix()` so we didn't suffix
commands at the start with ": ". All seems to work.
2016-01-13 17:46:36 +00:00
Matthew Hodgson 0772f50fab update copyright for 2016 2016-01-07 04:06:52 +00:00
Kegan Dougal 103b0a03b1 Hotfix for tab press bug
The bug was that *sometimes* typing in some letters then
pressing tab would flash red and not auto-complete. This was
happening because nextMatchedEntry was being called with 0
because the state of inPassiveMode was wrong.
2015-12-24 11:56:50 +00:00
Kegan Dougal fb151b35c8 Remove debug logging 2015-12-23 14:17:56 +00:00
Kegan Dougal 82ff5c5e52 Factor out handleTabPress and remove passive flag onKeyDown 2015-12-23 13:48:44 +00:00
Kegan Dougal b80015c69c More comments; remove redundant if statement 2015-12-23 13:33:44 +00:00
Kegan Dougal 095f82feee Remove boolean returns 2015-12-23 10:35:54 +00:00
Kegan Dougal 7e1b107f4c Review comments 2015-12-23 09:34:34 +00:00
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