mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-23 13:31:49 +00:00
Fix bug 2756:
* src/BufferView_pimpl.C (dispatch/LFUN_NEXT_INSET_TOGGLE): moved from LyXText. * src/text3.C (dispatch/LFUN_NEXT_INSET_TOGGLE): moved to BufferView::Pimpl, since this should work in mathed too. * src/mathed/math_nestinset.C (doDispatch/LFUN_INSET_TOGGLE): do not try to do the work which belongs to LFUN_NEXT_INSET_TOGGLE (bug 2756). git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14617 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
e658f6cd1f
commit
9c7696c6ee
@ -949,6 +949,7 @@ FuncStatus BufferView::Pimpl::getStatus(FuncRequest const & cmd)
|
||||
case LFUN_BIBTEX_DATABASE_ADD:
|
||||
case LFUN_BIBTEX_DATABASE_DEL:
|
||||
case LFUN_WORDS_COUNT:
|
||||
case LFUN_NEXT_INSET_TOGGLE:
|
||||
flag.enabled(true);
|
||||
break;
|
||||
|
||||
@ -1265,6 +1266,30 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & cmd)
|
||||
buffer_->params().compressed = !buffer_->params().compressed;
|
||||
break;
|
||||
|
||||
case LFUN_NEXT_INSET_TOGGLE: {
|
||||
// this is the real function we want to invoke
|
||||
FuncRequest tmpcmd = FuncRequest(LFUN_INSET_TOGGLE, cmd.origin);
|
||||
// if there is an inset at cursor, see whether it
|
||||
// wants to toggle.
|
||||
InsetBase * inset = cur.nextInset();
|
||||
if (inset && inset->isActive()) {
|
||||
LCursor tmpcur = cur;
|
||||
tmpcur.pushLeft(*inset);
|
||||
inset->dispatch(tmpcur, tmpcmd);
|
||||
if (tmpcur.result().dispatched()) {
|
||||
cur.dispatched();
|
||||
}
|
||||
}
|
||||
// if it did not work, try the underlying inset.
|
||||
if (!cur.result().dispatched())
|
||||
cur.dispatch(tmpcmd);
|
||||
|
||||
if (cur.result().dispatched())
|
||||
cur.clearSelection();
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
@ -657,15 +657,8 @@ void MathNestInset::doDispatch(LCursor & cur, FuncRequest & cmd)
|
||||
|
||||
case LFUN_INSET_TOGGLE:
|
||||
recordUndo(cur);
|
||||
//lockToggle();
|
||||
if (cur.pos() != cur.lastpos()) {
|
||||
// toggle previous inset ...
|
||||
cur.nextAtom().nucleus()->lock(!cur.nextAtom()->lock());
|
||||
} else if (cur.popLeft() && cur.pos() != cur.lastpos()) {
|
||||
// ... or enclosing inset if we are in the last inset position
|
||||
cur.nextAtom().nucleus()->lock(!cur.nextAtom()->lock());
|
||||
++cur.pos();
|
||||
}
|
||||
lock(!lock());
|
||||
cur.popRight();
|
||||
break;
|
||||
|
||||
case LFUN_SELF_INSERT:
|
||||
|
23
src/text3.C
23
src/text3.C
@ -747,28 +747,6 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
|
||||
cur.inset().showInsetDialog(bv);
|
||||
break;
|
||||
|
||||
case LFUN_NEXT_INSET_TOGGLE: {
|
||||
InsetBase * inset = cur.nextInset();
|
||||
// this is the real function we want to invoke
|
||||
cmd = FuncRequest(LFUN_INSET_TOGGLE);
|
||||
cur.undispatched();
|
||||
// if there is an inset at cursor, see whether it
|
||||
// wants to toggle.
|
||||
if (inset) {
|
||||
LCursor tmpcur = cur;
|
||||
tmpcur.pushLeft(*inset);
|
||||
inset->dispatch(tmpcur, cmd);
|
||||
if (tmpcur.result().dispatched()) {
|
||||
cur.clearSelection();
|
||||
cur.dispatched();
|
||||
}
|
||||
}
|
||||
// if it did not work, try the underlying inset.
|
||||
if (!cur.result().dispatched())
|
||||
cur.inset().dispatch(cur, cmd);
|
||||
break;
|
||||
}
|
||||
|
||||
case LFUN_SPACE_INSERT:
|
||||
if (cur.paragraph().layout()->free_spacing)
|
||||
insertChar(cur, ' ');
|
||||
@ -1792,7 +1770,6 @@ bool LyXText::getStatus(LCursor & cur, FuncRequest const & cmd,
|
||||
case LFUN_BREAK_PARAGRAPH_SKIP:
|
||||
case LFUN_PARAGRAPH_SPACING:
|
||||
case LFUN_INSET_INSERT:
|
||||
case LFUN_NEXT_INSET_TOGGLE:
|
||||
case LFUN_WORD_UPCASE:
|
||||
case LFUN_WORD_LOWCASE:
|
||||
case LFUN_WORD_CAPITALIZE:
|
||||
|
Loading…
Reference in New Issue
Block a user