Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not spell check the word which is still under typing #9

Closed
wapsi opened this issue Jan 22, 2021 · 12 comments
Closed

Do not spell check the word which is still under typing #9

wapsi opened this issue Jan 22, 2021 · 12 comments

Comments

@wapsi
Copy link

wapsi commented Jan 22, 2021

Now the spell checker check the word I'm writing immediately there are something to spell check, like:
Tämä on tes|
It whill highlight that "tes" word there even I haven't finished it: testiä.

There have been som discussion already about this on another issue, here: #3 (comment)

@fluks
Copy link
Owner

fluks commented Jan 22, 2021

I think we can't copy the exact behavior of the in-built spell checker. The best we can do is not to spell check the word under the cursor or near the cursor.

@wapsi
Copy link
Author

wapsi commented Jan 26, 2021

Yeah, but I think that should be enough. At least we'll get rid of the immediately highlighting of the words that I'm still typing :)

@fluks
Copy link
Owner

fluks commented Jan 26, 2021

Well, that was easy if it works now. I pushed a commit to the same branch.

@wapsi
Copy link
Author

wapsi commented Jan 26, 2021

Ok, I just compiled the new version and the initial tests are looking good! I'll try to write some more if any issues are found...

@wapsi
Copy link
Author

wapsi commented Jan 26, 2021

I think it works mostly now. But there is a case if I change (mistype) the word and move the cursor away it won't trigger the spell checking. I have to hit enter or put space or something else to trigger the spell checking. I made a screen record about the issue (it's easier to see what I mean from there):
https://user-images.githubusercontent.com/11405096/105880229-cb7ff700-600b-11eb-98a2-a97ce7aae0ab.mp4

@fluks
Copy link
Owner

fluks commented Jan 26, 2021

I have to add handler for click events to change that. Seems like it's an easy fix and I don't see anything negative happening if I do that.

@fluks
Copy link
Owner

fluks commented Jan 27, 2021

The same thing happens if you move the cursor with keyboard, so click event handler doesn't solve this entirely.

@fluks
Copy link
Owner

fluks commented Jan 27, 2021

Using a keydown event, for example, solves this but then the text isn't spell checked when you paste text with a mouse. Pasting with a mouse doesn't dispatch click event. And we can't have a listener for an input and a key* events because then text is spell checked twice. Looks like we have to choose what to support. Which one you would like to have?

@wapsi
Copy link
Author

wapsi commented Jan 27, 2021

Hmm, OK I undestand. I assume there is no possibility to listen changes of the textarea/input value / its content somehow?

@fluks
Copy link
Owner

fluks commented Jan 27, 2021

I take that back. There's a paste event, so I think changing input to keyup and adding click and paste event handlers the text is spell checked in every case. So we don't have to choose.

@fluks
Copy link
Owner

fluks commented Jan 27, 2021

Every corner case should now be covered in the newest commit.

@wapsi
Copy link
Author

wapsi commented Feb 3, 2021

Yes, I agree with you. I think it's perfect now (or at least all my test cases were working just fine). Thanks!

I think this issue / feature request can be closed if you want to? I can confirm that this functionality is added and tested, thanks!

@fluks fluks closed this as completed Feb 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants