commit 200064e9a40f5ecfe6b7e5b361d31be3eba5ce92
Author: Richard Kimberly Heck <rikih...@lyx.org>
Date:   Wed May 2 23:56:41 2018 -0400

    Do not step counters in deleted material.
    
    Also, display the counter as "#" if the inset is deleted.
---
 src/insets/InsetFlex.cpp |   10 +++++++---
 src/insets/InsetFoot.cpp |   11 ++++++++---
 2 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/src/insets/InsetFlex.cpp b/src/insets/InsetFlex.cpp
index 61e47d4..31828b6 100644
--- a/src/insets/InsetFlex.cpp
+++ b/src/insets/InsetFlex.cpp
@@ -146,9 +146,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);
 
diff --git a/src/insets/InsetFoot.cpp b/src/insets/InsetFoot.cpp
index 29890d1..3331184 100644
--- a/src/insets/InsetFoot.cpp
+++ b/src/insets/InsetFoot.cpp
@@ -84,9 +84,14 @@ void InsetFoot::updateBuffer(ParIterator const & it, 
UpdateType utype)
        InsetLayout const & il = getLayout();
        docstring const & count = il.counter();
        custom_label_ = translateIfPossible(il.labelstring());
-       if (cnts.hasCounter(count))
-               cnts.step(count, utype);
-       custom_label_ += ' ' + cnts.theCounter(count, lang->code());
+
+       Paragraph const & par = it.paragraph();
+       if (!par.isDeleted(it.pos())) {
+               if (cnts.hasCounter(count))
+                       cnts.step(count, utype);
+               custom_label_ += ' ' + cnts.theCounter(count, lang->code());
+       } else
+               custom_label_ += ' ' + from_ascii("#");
        setLabel(custom_label_);
 
        InsetCollapsible::updateBuffer(it, utype);

Reply via email to