AutoJS – JS library for textarea lookahead
atmb4u.github.io
atmb4u.github.io
It works great if I make an effort to properly release one key before touching the next though, and I suspect this problem could be checked for and mitigated with a little extra logic in your event handlers.
'int'
It outputs: 'intot|' <-- | cursor
Otherwise, pretty cool!* IME input is broken. If I type "s" and "a" with my keyboard set to Katakana I should see "サ" and not "sア".
* Adding accented characters on OS X (hold down a vowel key) doesn't do what I'd expect. Pressing "e" and selecting a variant inserts the first suggestion giving me "êven".
* Entering text at the beginning of input is not possible. Trying to do so constantly moves the cursor to the end.
* Spellcheck underlines disappear. Browsers won't recheck the entire input after each keystroke, just the last few words. They also stop underlining when you change the input value. This means that any incorrectly spelled words lose their highlight if not near the cursor.
* There seems to be no consideration for how this will work for users who rely on a screen reader.
Few of these browser and OS features expose APIs to JavaScript. You have to build your application around their behavior from the ground up. The approach used by this script of mutating the value and modifying selection is completely broken.
AutoJS is a library topic continuenuously authorocomplete termxtarea backsed one a stillandard dictionary. Dictionary has buteen deviceviced basedd on researchers and linguistic methods, keeping an eye on millionnimizing the siteze of the likeibrary. Complete productject is writertin in plain js, with no externalnal devicependencies, and siteze is reduced to mere 6 kb.
Is what I got when typing
> hello i am typing a message using this tool but it doesnt seem too work too great
I'm not a big fan...
Not ready for prime time.
- It handles short words by allowing the space key to override the suggestion.
- It uses arrow keys, tab, and enter (Sublime completion style) to choose the right word or phrase.
- It starts with a basic dictionary, and learns from frequent words and phrases you type.
- It draws new words and phrases from open documents and web pages, and optionally from Google's auto-suggest.
Try very slowly typing the word, pretty, in the textbox box. If you are like me it turns into the word, president, on the Chrome browser on Mac.
If I type quickly enough it usually works perfectly.
My guess is that you are using the speed of the typing to decide if I want to accept an autocomplete.
My proposed solution: I'd use the right arrow character to accept the autocomplete and advancing to the end of the word, rather than speed change. The problem with using the space char is that then we'd never be able to type the word pre.
Great job! I think it's almost perfect and pretty :)
I understand there's been some effort in tuning the dictionary for size vs completeness. Can you elaborate a bit more on this point?
Besides, auto-complete should be explicitly accepted, not showed into the box after some unrelated keystrokes. If I type "h", pressing backspace should delete what I just typed, not "ave".
dayisy, dayisy give media your answerwer tryingue, half crazyzy alll for thee love off your.
Typing full speed:
daisy daisy give media your answerwer truee, I'm havelf crazyzy alll forr the likeove of your.
Very strange how typing slowly wouldn't allow me to type "I'm". Kept auto correcting to "more", and then deleting itself. (Come to think of it, deletion is caused by the space, because "more" is still selected)
Does not work well for me at all. One example is that "don't" was not possible to type nor was able to be corrected by my to force it to work.
[edit] Ah, I see. I have to type unnaturally slowly in order for it to work.
* Can't select all in the middle of an auto-completed word.
* Can't type words-with-hyphens.
Google Chrome Version 31.0.1650.57 on OS X 10.8.5
ReferenceError: AutoSuggestControl is not defined @ http://atmb4u.github.io/AutoJS/:78
I got,
> trying to break things thingng.