From: Jean-Marc Lasgouttes Date: Fri, 12 Feb 2010 11:25:44 +0000 (+0000) Subject: Fix bug #6217: Replacing a word in spellcheck does not update toolbar X-Git-Tag: 2.0.0~4053 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=09ef9c67efbf1081482a0e8f59643d8676bac6ad;p=features.git Fix bug #6217: Replacing a word in spellcheck does not update toolbar Use the dispatch machinery when replacing a word in the spellchecker. Note that this implies a slight hack with lyxrc.auto_region_delete setting. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33445 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/frontends/qt4/GuiSpellchecker.cpp b/src/frontends/qt4/GuiSpellchecker.cpp index 29254216d7..58dbf57319 100644 --- a/src/frontends/qt4/GuiSpellchecker.cpp +++ b/src/frontends/qt4/GuiSpellchecker.cpp @@ -204,13 +204,16 @@ void GuiSpellchecker::on_replacePB_clicked() docstring const replacement = qstring_to_ucs4(d->ui.replaceCO->currentText()); LYXERR(Debug::GUI, "Replace (" << replacement << ")"); - BufferView * bv = const_cast(bufferview()); - if (!bv->cursor().inTexted()) - return; - cap::replaceSelectionWithString(bv->cursor(), replacement, true); - bv->buffer().markDirty(); - // If we used an LFUN, we would not need that - bv->processUpdateFlags(Update::Force | Update::FitCursor); + /* + 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_; check();