From 452d7e28c065455ca6dae128ca41fce0a8345e66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Spitzm=C3=BCller?= Date: Tue, 6 Nov 2007 13:46:52 +0000 Subject: [PATCH] * src/frontends/qt4/QSpellchecker.cpp: - fix bug 2218 (spellchecher skips first word) git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_5_X@21470 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt4/QSpellchecker.cpp | 24 +++++++++++++++++++++++- status.15x | 3 +++ 2 files changed, 26 insertions(+), 1 deletion(-) 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).