Bug 436004 - Automatic spell checking does not work initially and must be disabled then re-enabled to work
Summary: Automatic spell checking does not work initially and must be disabled then re...
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Unclassified
Component: kwrite (show other bugs)
Version: 20.12.3
Platform: Manjaro Linux
: NOR normal (vote)
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
: 437056 (view as bug list)
Depends on:
Blocks:
 
Reported: 2021-04-21 14:38 UTC by Michael D
Modified: 2021-05-22 17:17 UTC (History)
6 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.83


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael D 2021-04-21 14:38:34 UTC
If I load a file with automatic spell checking enabled, it does not underline misspelled words. I need to disable automatic spell checking and then reenable it for it to underline misspelled words.
Comment 1 Nate Graham 2021-04-22 18:01:35 UTC
Works for me FWIW.
Comment 2 Michael D 2021-04-22 18:11:27 UTC
Did you try just opening a pre-existing file? Start a new kwrite document and start typing misspelled words and see if it detects them. Because I just noticed that when I open a new file, auto spell check works, but if I create a new file and start typing, it doesn't.
Comment 3 Nate Graham 2021-04-22 18:13:08 UTC
Yep. Both cases work in KWrite for me.
Comment 4 Michael D 2021-04-22 18:21:17 UTC
Weird. Another oddity: when I invoke a certain function, e.g. find, replace, word wrap, or unhiding the menu bar, auto spell check starts working. Might that be a clue?
Comment 5 Johnny 2021-04-23 20:37:06 UTC
Probably the same on Arch Linux.

For me regression started with "qt5-base-5.15.2+kde+r171-2-x86_64"
The "qt5-base-5.15.2-5-x86_64" worked perfectly.

And now elaborate:
Spellcheck doesn't work "on type," i.e. works only upon scrolling the line which one desire to check off the screen and back on. 
Regardless of whether the "Automatic spell checking is enable by default" option is enabled.

I am using GB hunspell with Kate.
Comment 6 Peter Kreussel 2021-05-13 20:48:53 UTC
Seeing the same as Johnny, also on Arch Linux with Hunspell de_De.

In addition, I switched on debug reporting for sonnet core + sonnet hunspell, which gave me:

kf.sonnet.clients.hunspell:  SpellerPlugin *HunspellClient::createSpeller(const QString &language) ; "de_DE"
kf.sonnet.clients.hunspell: Loading dictionary for "de_DE" from "/usr/share/hunspell"
kf.sonnet.clients.hunspell: Load a user dictionary "/home/peter/.hunspell_de_DE"
kf.sonnet.clients.hunspell: Created  0x563e505be0a0
kf.sonnet.core: Using the "Hunspell" plugin for language "de_DE"
kf.sonnet.clients.hunspell:  isCorrect : "sfsdf"
kf.sonnet.clients.hunspell:  result : false
kf.sonnet.clients.hunspell:  isCorrect : "sdfsdf"
kf.sonnet.clients.hunspell:  result : false
kf.sonnet.clients.hunspell:  isCorrect : "d"
kf.sonnet.clients.hunspell:  result : true
kf.sonnet.clients.hunspell:  isCorrect : "f"
kf.sonnet.clients.hunspell:  result : true
kf.sonnet.clients.hunspell:  isCorrect : "g"
kf.sonnet.clients.hunspell:  result : true

I.e.: I switched on auto spellcheck with the text "sfsdf sdfsdf" already typed. Which got the red mark as expected. With auto spellcheck on I typed "dfg", which did not get marked as wrong. 

If I interpret correctly, hunspell checked every single letter separately instead of the whole word "dfg", thus getting the result "isCorrect".

I remember that some time ago (sorry, cannot say exactly when) German Umlaute caused the problem that all letters behind them were always marked as wrong. Later (very probably as Johnny described after "qt5-base-5.15.2+kde+r171-2-x86_64" this changed to spellcheck on typing not working any more.

So, word segmentation broke and was "fixed"?


Software versions:
qt5-base: 5.15.2+kde+r192-1
kde frameworks: 5.82.0
kde gear: 21.04
hunspell: 1.7.0
Comment 7 Johnny 2021-05-17 05:53:37 UTC
Not "very probably," but "most precisely."

For I tried to downgrade sole package "qt5-base-5.15.2+kde+r171-2-x86_64" (the first version for me where appeared "kde") to "qt5-base-5.15.2-5-x86_64" and the issue disappeared. 

The problem persists indeed, as of now with:

qt5-base 5.15.2+kde+r192-1
kate 21.04.1
Comment 8 Peter Kreussel 2021-05-17 06:41:07 UTC
Downgrading to qt5-base-5.15.2-5-x86_64 works for me, too. Automatic spell checking also works for German Umlaute after that.
Comment 9 Christoph Cullmann 2021-05-17 20:21:09 UTC
I can reproduce with 5.15.2+kde+r192-1, too :/

Shouldn't the KDE patches be more or less transparent and only contain minimal fixes?
Comment 10 Christoph Cullmann 2021-05-17 20:22:11 UTC
Hi, David, have you some idea? Given people say only downgrading qt-base to the pre-KDE-patches resolves this, this seems strange :/
Comment 11 Christoph Cullmann 2021-05-17 20:28:25 UTC
We had previously some issue with unicode chars inside words, but that was fixed in e.g. bug 433673.
Comment 12 Bug Janitor Service 2021-05-19 16:06:20 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/ktexteditor/-/merge_requests/154
Comment 13 Antonio Rojas 2021-05-19 16:36:14 UTC
Git commit 253cc3bba36ab593a3224914521eabdb5fed5266 by Antonio Rojas.
Committed on 19/05/2021 at 16:01.
Pushed by cullmann into branch 'master'.

Fix on-the-fly spell checking with recent Qt

Qt commit 3a273ac47f20e82a1f2f63411b210025ca0f4495 changed the behavior of lastIndexOf, so it now starts matching the zero-length regexps from the end of the string.

This made the regexp '\b' match the end of the string, making the spell checker think that every character is a word by itself.

Fix it by ignoring the last character of the string when searching for the word boundary.

M  +2    -2    src/spellcheck/ontheflycheck.cpp

https://invent.kde.org/frameworks/ktexteditor/commit/253cc3bba36ab593a3224914521eabdb5fed5266
Comment 14 Michael D 2021-05-19 16:47:29 UTC
Thanks for the quick fix!
Comment 15 Antonio Rojas 2021-05-22 17:17:48 UTC
*** Bug 437056 has been marked as a duplicate of this bug. ***