r15368 by cbradney - Apply text styles patch from avox

scribus-commit scribus-commit at lists.scribus.net
Tue Jul 20 00:01:01 CEST 2010


Revision: 15368
Author: cbradney
Date: 2010-07-19T21:57:05.159695Z
Commit message: Apply text styles patch from avox

Changeset: 
M  /branches/Version135/Scribus/scribus/text/storytext.cpp

Diffs:
Index: scribus/text/storytext.cpp
===================================================================
--- scribus/text/storytext.cpp	(revision 15367)
+++ scribus/text/storytext.cpp	(revision 15368)
@@ -630,15 +630,26 @@
 	if (len == 0)
 		return;
 
+	int lastParStart = pos == 0? 0 : -1;
 	ScText* itText;
 	for (uint i=pos; i < pos+len; ++i) {
 		itText = d->at(i);
-		// #6165 : applying style on last character applies style on whole text on next open 
-		/*if (itText->ch == SpecialChars::PARSEP && itText->parstyle != NULL)
-			itText->parstyle->charStyle().applyCharStyle(style);*/
+		// #6165 : applying style on last character applies style on whole text on next open
+		// #9173 et. al.: move charstyle to parstyle if whole paragraph is affected
+		if (itText->ch == SpecialChars::PARSEP && itText->parstyle != NULL && lastParStart >= 0)
+		{
+			eraseCharStyle(lastParStart, i - lastParStart, style);
+			itText->parstyle->charStyle().applyCharStyle(style);
+			lastParStart = i + 1;
+		}
 		itText->applyCharStyle(style);
 	}
-
+	if (pos + signed(len) == length() && lastParStart >= 0)
+	{
+		eraseCharStyle(lastParStart, length() - lastParStart, style);
+		d->trailingStyle.charStyle().applyCharStyle(style);
+	}
+	
 	invalidate(pos, pos + len);
 }
 
@@ -663,6 +674,10 @@
 			itText->parstyle->charStyle().eraseCharStyle(style);
 		itText->eraseCharStyle(style);
 	}
+	if (pos + signed(len) == length())
+	{
+		d->trailingStyle.charStyle().eraseCharStyle(style);
+	}
 	
 	invalidate(pos, pos + len);
 }




More information about the scribus-commit mailing list