I cannot see why on_replacePB_clicked is so different from on_replaceAllPB_clicked. Does anybody have an explanation? The attached patch would simplify on_replacePB_clicked a lot and works.
Stephan
Index: src/frontends/qt4/GuiSpellchecker.cpp =================================================================== --- src/frontends/qt4/GuiSpellchecker.cpp (Revision 36542) +++ src/frontends/qt4/GuiSpellchecker.cpp (Arbeitskopie) @@ -214,20 +214,12 @@ void GuiSpellchecker::on_replacePB_clicked() { docstring const replacement = qstring_to_ucs4(d->ui.replaceCO->currentText()); + docstring const data = replace2string( + replacement, qstring_to_ucs4(d->ui.wordED->text()), + true, true, false, false); LYXERR(Debug::GUI, "Replace (" << replacement << ")"); - /* - Slight hack ahead: we want to use the dispatch machinery - (see bug #6217), but self-insert honors the ``auto region - delete'' setting, which is not wanted here. Creating a new - ad-hoc LFUN seems overkill, but it could be an option (JMarc). - */ - bool const ard = lyxrc.auto_region_delete; - lyxrc.auto_region_delete = true; - dispatch(FuncRequest(LFUN_SELF_INSERT, replacement)); - lyxrc.auto_region_delete = ard; - // fix up the count - --d->count_; + dispatch(FuncRequest(LFUN_WORD_REPLACE, data)); check(); }