diff --git a/src/frontends/qt4/GuiSpellchecker.cpp b/src/frontends/qt4/GuiSpellchecker.cpp index da8cca1ad3..5dbdbbb0b0 100644 --- a/src/frontends/qt4/GuiSpellchecker.cpp +++ b/src/frontends/qt4/GuiSpellchecker.cpp @@ -315,8 +315,13 @@ void SpellcheckerWidget::on_replacePB_clicked() return; docstring const textfield = qstring_to_ucs4(d->ui.wordED->text()); docstring const replacement = qstring_to_ucs4(d->ui.replaceCO->currentText()); - docstring const datastring = replace2string(replacement, textfield, - true, true, false, false); + docstring const datastring = + replace2string(replacement, textfield, + true, // case sensitive + true, // match word + false, // all words + true, // forward + false); // find next LYXERR(Debug::GUI, "Replace (" << replacement << ")"); dispatch(FuncRequest(LFUN_WORD_REPLACE, datastring)); @@ -332,8 +337,13 @@ void SpellcheckerWidget::on_replaceAllPB_clicked() return; docstring const textfield = qstring_to_ucs4(d->ui.wordED->text()); docstring const replacement = qstring_to_ucs4(d->ui.replaceCO->currentText()); - docstring const datastring = replace2string(replacement, textfield, - true, true, true, true); + docstring const datastring = + replace2string(replacement, textfield, + true, // case sensitive + true, // match word + true, // all words + true, // forward + false); // find next LYXERR(Debug::GUI, "Replace all (" << replacement << ")"); dispatch(FuncRequest(LFUN_WORD_REPLACE, datastring)); diff --git a/src/frontends/qt4/Menus.cpp b/src/frontends/qt4/Menus.cpp index d0f2e4586d..367f14b120 100644 --- a/src/frontends/qt4/Menus.cpp +++ b/src/frontends/qt4/Menus.cpp @@ -783,7 +783,11 @@ void MenuDefinition::expandSpellingSuggestions(BufferView const * bv) MenuItem w(MenuItem::Command, toqstr(suggestion), FuncRequest(LFUN_WORD_REPLACE, replace2string(suggestion, selection, - true, true, false, true, false))); + true, // case sensitive + true, // match word + false, // all words + true, // forward + false))); // find next if (i < m) add(w); else diff --git a/src/lyxfind.cpp b/src/lyxfind.cpp index 7883475aab..f2c941bcab 100644 --- a/src/lyxfind.cpp +++ b/src/lyxfind.cpp @@ -275,9 +275,6 @@ pair replaceOne(BufferView * bv, docstring searchstr, if (forward) { cur.pos() += replacestr.length(); LASSERT(cur.pos() <= cur.lastpos(), /* */); - } else { - cur.pos() -= replacestr.length(); - LASSERT(cur.pos() >= 0, /* */); } if (findnext) findOne(bv, searchstr, case_sens, whole, forward, false); diff --git a/status.20x b/status.20x index b4efefbe5f..8c492b4b45 100644 --- a/status.20x +++ b/status.20x @@ -138,6 +138,8 @@ What's new - When using a non-default language for the GUI, do not change locale settings of child proceses (bug 7741). +- Fix crash in text replacement with spell checker (bug 8238). + * DOCUMENTATION AND LOCALIZATION