mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-18 21:45:24 +00:00
Fix bug #6217: Replacing a word in spellcheck does not update toolbar
This commit uses the self-insert LFUN to make the replacement, so that the dispatch machinery can do its magic. Note the comment: to make it work, one has to change temporarily the value of auto_region_delete. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_6_X@33567 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
e1f12991f8
commit
db344e54e0
@ -20,6 +20,7 @@
|
||||
#include "BufferView.h"
|
||||
#include "Cursor.h"
|
||||
#include "CutAndPaste.h"
|
||||
#include "FuncRequest.h"
|
||||
#include "Language.h"
|
||||
#include "LyXRC.h"
|
||||
#include "Paragraph.h"
|
||||
@ -464,16 +465,21 @@ void GuiSpellchecker::replace(docstring const & replacement)
|
||||
{
|
||||
LYXERR(Debug::GUI, "GuiSpellchecker::replace("
|
||||
<< to_utf8(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
|
||||
--count_;
|
||||
check();
|
||||
// Do nothing if the spellchecker has been terminated already
|
||||
if (speller_)
|
||||
check();
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user