diff --git a/src/spellcheck/spellcheckbar.cpp b/src/spellcheck/spellcheckbar.cpp --- a/src/spellcheck/spellcheckbar.cpp +++ b/src/spellcheck/spellcheckbar.cpp @@ -143,6 +143,7 @@ // called from hideMe, so don't call it again! d->canceled = true; d->deleteProgressDialog(false); // this method can be called in response to + d->replaceAllMap.clear(); // pressing 'Cancel' on the dialog emit cancel(); emit spellCheckStatus(i18n("Spell check canceled.")); @@ -355,6 +356,7 @@ replacementText); d->checker->continueChecking(); } else { + setProgressDialogVisible(false); d->checker->stop(); } } @@ -406,6 +408,9 @@ void SpellCheckBar::fillSuggestions(const QStringList &suggs) { d->suggestionsModel->setStringList(suggs); + if (!suggs.isEmpty()) { + d->ui.cmbReplacement->setCurrentIndex(0); + } } void SpellCheckBar::slotMisspelling(const QString &word, int start) diff --git a/src/spellcheck/spellcheckdialog.cpp b/src/spellcheck/spellcheckdialog.cpp --- a/src/spellcheck/spellcheckdialog.cpp +++ b/src/spellcheck/spellcheckdialog.cpp @@ -195,7 +195,6 @@ KTextEditor::DocumentPrivate *doc = m_view->doc(); KTextEditor::EditorPrivate::self()->spellCheckManager()->replaceCharactersEncodedIfNecessary(newWord, doc, replacementRange); - m_currentSpellCheckRange.setRange(KTextEditor::Range(replacementStartCursor, m_currentSpellCheckRange.end())); // we have to be careful here: due to static word wrapping the text might change in addition to simply // the misspelled word being replaced, i.e. new line breaks might be inserted as well. As such, the text // in the 'Sonnet::Dialog' might be eventually out of sync with the visible text. Therefore, we 'restart' @@ -207,6 +206,8 @@ { if (range.isEmpty()) { spellCheckDone(); + m_sonnetDialog->closed(); + return; } m_languagesInSpellCheckRange = KTextEditor::EditorPrivate::self()->spellCheckManager()->spellCheckLanguageRanges(m_view->doc(), range); m_currentLanguageRangeIterator = m_languagesInSpellCheckRange.begin(); @@ -217,6 +218,8 @@ m_view->bottomViewBar()->showBarWidget(m_sonnetDialog); m_sonnetDialog->show(); m_sonnetDialog->setFocus(); + } else { + m_sonnetDialog->closed(); } }