r24431 by jghali - A few fixes related to numerated lists

scribus-commit scribus-commit at lists.scribus.net
Tue Jan 26 22:47:00 UTC 2021


Author: jghali
Date: Tue Jan 26 22:47:00 2021
New Revision: 24431

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=24431
Log:
A few fixes related to numerated lists

Modified:
    trunk/Scribus/scribus/scribusdoc.cpp

Modified: trunk/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24431&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp	(original)
+++ trunk/Scribus/scribus/scribusdoc.cpp	Tue Jan 26 22:47:00 2021
@@ -16505,6 +16505,7 @@
 		numS = new NumStruct;
 		numS->m_name = "default";
 		Numeration newNum;
+		newNum.suffix = ".";
 		numS->m_nums.insert(0, newNum);
 		numS->m_counters.insert(0, 0);
 		numS->m_lastlevel = -1;
@@ -16576,14 +16577,21 @@
 	{
 		if (pos != 0 && itemText.text(pos - 1) != SpecialChars::PARSEP)
 			continue;
+
+		const ParagraphStyle& style = itemText.paragraphStyle(pos);
+		if (!style.hasNum() || (style.numName() != "<local block>"))
+			continue;
+
 		Mark* mark = itemText.mark(pos);
 		if (mark == nullptr)
-			continue;
-		if (!mark->isType(MARKBullNumType) || !itemText.paragraphStyle(pos).hasNum())
-			continue;
-
-		const ParagraphStyle& style = itemText.paragraphStyle(pos);
-		if (style.numName() != "<local block>")
+		{
+			BulNumMark* bnMark = new BulNumMark;
+			itemText.insertMark(bnMark, pos);
+			CharStyle emptyCS;
+			itemText.setCharStyle(pos, 1, emptyCS);
+			mark = itemText.mark(pos);
+		}
+		if (!mark->isType(MARKBullNumType))
 			continue;
 
 		int level = style.numLevel();
@@ -16640,7 +16648,8 @@
 		if (mark->getString() != result)
 		{
 			mark->setString(result);
-			firstInvalidChar = pos;
+			if (firstInvalidChar < 0)
+				firstInvalidChar = pos;
 		}
 	}
 	return firstInvalidChar;
@@ -16772,7 +16781,8 @@
 					if (mark && mark->getString() != prefixStr)
 					{
 						mark->setString(prefixStr);
-						firstInvalidChar1 = pos;
+						if (firstInvalidChar1 < 0)
+							firstInvalidChar1 = pos;
 					}
 				}
 				if (item->itemText.text(pos) == SpecialChars::PARSEP)




More information about the scribus-commit mailing list