From d60537a8444e45d0cf3c33f0e0627d1257581168 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=BCrgen=20Spitzm=C3=BCller?= Date: Mon, 22 Dec 2008 10:24:43 +0000 Subject: [PATCH] * Text3.cpp: - enable LFUN_INSET_DISSOLVE for insets at cursor (bug 4985). git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@27947 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/Text3.cpp | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/src/Text3.cpp b/src/Text3.cpp index a20b366035..699482171a 100644 --- a/src/Text3.cpp +++ b/src/Text3.cpp @@ -897,9 +897,29 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd) break; } - case LFUN_INSET_DISSOLVE: - needsUpdate |= dissolveInset(cur); + case LFUN_INSET_DISSOLVE: { + // first, try if there's an inset at cursor + // FIXME: this first part should be moved to + // a LFUN_NEXT_INSET_DISSOLVE, or be called via + // some generic "next-inset inset-dissolve" + Inset * inset = cur.nextInset(); + if (inset && inset->isActive()) { + Cursor tmpcur = cur; + tmpcur.pushBackward(*inset); + inset->dispatch(tmpcur, cmd); + if (tmpcur.result().dispatched()) { + cur.dispatched(); + break; + } + } + // if it did not work, try the underlying inset + if (dissolveInset(cur)) { + needsUpdate = true; + break; + } + // if it did not work, do nothing. break; + } case LFUN_INSET_SETTINGS: { Inset & inset = cur.inset(); @@ -2212,8 +2232,10 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd, enable = cur.inset().lyxCode() == FLEX_CODE && il.lyxtype() == type; } else { - enable = !isMainText(cur.bv().buffer()) - && cur.inset().nargs() == 1; + enable = ((!isMainText(cur.bv().buffer()) + && cur.inset().nargs() == 1) + || (cur.nextInset() + && cur.nextInset()->nargs() == 1)); } break; -- 2.39.2