diff --git a/src/frontends/qt4/QSpellchecker.cpp b/src/frontends/qt4/QSpellchecker.cpp index a09bc4e3a6..d70bd3c978 100644 --- a/src/frontends/qt4/QSpellchecker.cpp +++ b/src/frontends/qt4/QSpellchecker.cpp @@ -147,8 +147,30 @@ void QSpellchecker::build_dialog() void QSpellchecker::update_contents() { - if (isVisible() || controller().exitEarly()) + // The clauses below are needed because the spellchecker + // controller has many flaws (see bugs 1950, 2218). + // Basically, we have to distinguish the case where a + // spellcheck has already been performed for the whole + // document (exitEarly() == true, isVisible() == false) + // from the rest (exitEarly() == false, isVisible() == true). + static bool check_after_early_exit; + if (controller().exitEarly()) { + // a spellcheck has already been performed, controller().check(); + check_after_early_exit = true; + } + else if (isVisible()) { + // the above check triggers a second update, + // and isVisible() is true then. Prevent a + // second check that skips the first word + if (check_after_early_exit) + // don't check, but reset the bool. + // business as usual after this. + check_after_early_exit = false; + else + // perform spellcheck (default case) + controller().check(); + } } diff --git a/status.15x b/status.15x index 5560208233..3b4927b59a 100644 --- a/status.15x +++ b/status.15x @@ -123,6 +123,9 @@ What's new - Fix a bug where the spellchecker didn't update the screen display on the last of several misspelt words (bug 3586). +- Fix a bug where the spellchecker skipped the first misspelled word on a second + run (bug 2218). + - Do not close the error dialog on double click (bug 4090). - Fix cut and paste of tabular cells via the external clipboard (bug 4147).