]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetFlex.cpp
requires is a keyword in C++2a
[lyx.git] / src / insets / InsetFlex.cpp
index 61e47d4c367f1737a4e69e821937b4abf09040a9..c91d65ec377c07773a67f3e254e25f4113dd1115 100644 (file)
@@ -99,7 +99,9 @@ bool InsetFlex::getStatus(Cursor & cur, FuncRequest const & cmd,
                        InsetLayout const & il = getLayout();
                        InsetLayout::InsetLyXType const type =
                                translateLyXType(to_utf8(cmd.argument()));
-                       if (il.lyxtype() == type) {
+                       if (il.lyxtype() == type
+                           || (il.name() == DocumentClass::plainInsetLayout().name()
+                                   && type == InsetLayout::CHARSTYLE)) {
                                FuncRequest temp_cmd(LFUN_INSET_DISSOLVE);
                                return InsetCollapsible::getStatus(cur, temp_cmd, flag);
                        } else
@@ -121,7 +123,9 @@ void InsetFlex::doDispatch(Cursor & cur, FuncRequest & cmd)
                        InsetLayout::InsetLyXType const type =
                                translateLyXType(to_utf8(cmd.argument()));
 
-                       if (il.lyxtype() == type) {
+                       if (il.lyxtype() == type
+                           || (il.name() == DocumentClass::plainInsetLayout().name()
+                                   && type == InsetLayout::CHARSTYLE)) {
                                FuncRequest temp_cmd(LFUN_INSET_DISSOLVE);
                                InsetCollapsible::doDispatch(cur, temp_cmd);
                        } else
@@ -136,7 +140,7 @@ void InsetFlex::doDispatch(Cursor & cur, FuncRequest & cmd)
 }
 
 
-void InsetFlex::updateBuffer(ParIterator const & it, UpdateType utype)
+void InsetFlex::updateBuffer(ParIterator const & it, UpdateType utype, bool const deleted)
 {
        BufferParams const & bp = buffer().masterBuffer()->params();
        InsetLayout const & il = getLayout();
@@ -146,9 +150,13 @@ void InsetFlex::updateBuffer(ParIterator const & it, UpdateType utype)
        docstring const & count = il.counter();
        bool const have_counter = cnts.hasCounter(count);
        if (have_counter) {
-               cnts.step(count, utype);
-               custom_label += ' ' +
-                       cnts.theCounter(count, it.paragraph().getParLanguage(bp)->code());
+               Paragraph const & par = it.paragraph();
+               if (!par.isDeleted(it.pos())) {
+                       cnts.step(count, utype);
+                       custom_label += ' ' +
+                               cnts.theCounter(count, it.paragraph().getParLanguage(bp)->code());
+               } else
+                       custom_label += ' ' + from_ascii("#");
        }
        setLabel(custom_label);
 
@@ -159,7 +167,7 @@ void InsetFlex::updateBuffer(ParIterator const & it, UpdateType utype)
                // need a layout flag
                cnts.saveLastCounter();
        }
-       InsetCollapsible::updateBuffer(it, utype);
+       InsetCollapsible::updateBuffer(it, utype, deleted);
        if (save_counter)
                cnts.restoreLastCounter();
 }