]> git.lyx.org Git - features.git/commitdiff
Fix bug #6217: Replacing a word in spellcheck does not update toolbar
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Fri, 12 Feb 2010 11:25:44 +0000 (11:25 +0000)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Fri, 12 Feb 2010 11:25:44 +0000 (11:25 +0000)
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

src/frontends/qt4/GuiSpellchecker.cpp

index 29254216d72b12db305a5b0380231356c264d64c..58dbf57319bd23135b48038efac2ec93934cb3c6 100644 (file)
@@ -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 *>(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();