Jean-Marc Lasgouttes <[EMAIL PROTECTED]> writes:

| I took a look at bug 668 and here are my findings (as added to the bug
| itself). Lars, I hope this is enough to get you started...

Ok, I have two patches for this one. Two different ones that both seem
to fix the problem.

I fear that one of them only fixes this special case, but I hope that
other one is generic enough to fix all such problems:

specific:

text2.C: ~1379 voidLyXText::updateCounters(BufferView * bview) const

                setCounter(bview->buffer(), par);

                // now check for the headline layouts. remember that they
                // have a dynamic left margin
                LyXLayout_ptr const & layout = par->layout();

                if (layout->margintype == MARGIN_DYNAMIC
+                   || layout->labeltype == LABEL_CENTERED_TOP_ENVIRONMENT
                    || layout->labeltype == LABEL_SENSITIVE) {
                        // Rebreak the paragraph
                        removeParagraph(row);
                        appendParagraph(bview, row);
                }


hopefully generic:

text2.C: ~1379 voidLyXText::updateCounters(BufferView * bview) const

                string const oldLabel = par->params().labelString();

                setCounter(bview->buffer(), par);

                string const & newLabel = par->params().labelString();

                // If the label changed, rebreak the paragraph.
                if (newLabel != oldLabel) {
                        removeParagraph(row);
                        appendParagraph(bview, row);
                }

Index: src/text2.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text2.C,v
retrieving revision 1.264
diff -u -p -r1.264 text2.C
--- src/text2.C	4 Nov 2002 02:12:30 -0000	1.264
+++ src/text2.C	5 Nov 2002 18:09:41 -0000
@@ -1378,6 +1378,7 @@ void LyXText::updateCounters(BufferView 
 		while (row->par() != par)
 			row = row->next();
 
+#if 0
 		setCounter(bview->buffer(), par);
 
 		// now check for the headline layouts. remember that they
@@ -1385,11 +1386,24 @@ void LyXText::updateCounters(BufferView 
 		LyXLayout_ptr const & layout = par->layout();
 
 		if (layout->margintype == MARGIN_DYNAMIC
-		    || layout->labeltype == LABEL_SENSITIVE) {
+		    || layout->labeltype == LABEL_SENSITIVE
+		    || layout->labeltype == LABEL_CENTERED_TOP_ENVIRONMENT) {
 			// Rebreak the paragraph
 			removeParagraph(row);
 			appendParagraph(bview, row);
 		}
+#else
+		string const oldLabel = par->params().labelString();
+
+		setCounter(bview->buffer(), par);
+
+		string const & newLabel = par->params().labelString();
+
+		if (newLabel != oldLabel) {
+			removeParagraph(row);
+			appendParagraph(bview, row);
+		}
+#endif
 		par = par->next();
 	}
 }

-- 
        Lgb

Reply via email to