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

Don't highlight the whole text on every key press #3

Open
fluks opened this issue Jan 19, 2020 · 5 comments
Open

Don't highlight the whole text on every key press #3

fluks opened this issue Jan 19, 2020 · 5 comments
Labels
enhancement New feature or request

Comments

@fluks
Copy link
Owner

fluks commented Jan 19, 2020

Highlighting all the text on every key press is slow if the text is long or you write fast. Only the edited word should be highlighted on every key press and all the other highlighting should stay as they are.

@fluks fluks added the bug Something isn't working label Jan 19, 2020
@fluks fluks added enhancement New feature or request and removed bug Something isn't working labels May 12, 2020
@fluks
Copy link
Owner Author

fluks commented May 12, 2020

Commit dabac78 somewhat improved the situation.

@wapsi
Copy link

wapsi commented Jan 22, 2021

Is the commit dabac78 already in the 0.6.0 version which can be downloaded from the Firefox's AddOn site? Because it still hilights the word even I haven't finished to write the word?

Could there be some kind of solution that checks (by using regex) that there must be space or some special character after the word (other than A-Ö/a-ö, like . , \n 0-9 and so on) and only then it checks the spelling of the word? And maybe if the cursor is moved to somewhere else within the written text it checks the last word even there isn't any special character found after that?

@fluks
Copy link
Owner Author

fluks commented Jan 22, 2021

Is the commit dabac78 already in the 0.6.0 version which can be downloaded from the Firefox's AddOn site? Because it still hilights the word even I haven't finished to write the word?

Yes, it is. I think you misunderstood what this issue is about. It's not really about whether or not to highlight the current word under cursor but efficiency of the code. I would like to send only the current word to libvoikko and highlight only that word, leaving the rest as is. Now the situation is that all the text is sent to libvoikko and all the text is highlighted again when a key is pressed.

Highlighting or not the word you are writing is a different issue and I haven't thought about it. This issue does affect it too though.

Could there be some kind of solution that checks (by using regex) that there must be space or some special character after the word (other than A-Ö/a-ö, like . , \n 0-9 and so on) and only then it checks the spelling of the word? And maybe if the cursor is moved to somewhere else within the written text it checks the last word even there isn't any special character found after that?

You could find an algorithm, but see the answer for the previous question. It's not enough to check the last word because you can change a word anywhere else in the text other than in the end. Maybe the last word under the cursor once it's moved or at onblur event.

I guess you haven't experienced slowing down the spellchecking? It probably requires 1000s of words depending on the CPU.

@wapsi
Copy link

wapsi commented Jan 22, 2021

Maybe the last word under the cursor once it's moved or at onblur event.

I think this is the one I was looking for. Once the cursor has "left" a word behind (either by moving the cursor with mouse or by hitting space or . or , and so on.) it triggers the spell checking for that word?

And yes, you are correct. This issue is not about that. Should I create a separate issue about this?

@fluks
Copy link
Owner Author

fluks commented Jan 22, 2021

And yes, you are correct. This issue is not about that. Should I create a separate issue about this?

Yes.

I think it might be possible to fix your issue without fixing this even.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants