r19797 by jghali - #12893: fix counting of characters in story editor

scribus-commit scribus-commit at lists.scribus.net
Sat Feb 7 01:29:25 UTC 2015


Author: jghali
Date: Sat Feb  7 01:29:25 2015
New Revision: 19797

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=19797
Log:
#12893: fix counting of characters in story editor

Modified:
    trunk/Scribus/scribus/ui/storyeditor.cpp

Modified: trunk/Scribus/scribus/ui/storyeditor.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19797&path=/trunk/Scribus/scribus/ui/storyeditor.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/storyeditor.cpp (original)
+++ trunk/Scribus/scribus/ui/storyeditor.cpp Sat Feb  7 01:29:25 2015
@@ -2660,14 +2660,20 @@
 	int start = Editor->StyledText.startOfParagraph(p);
 	int end = Editor->StyledText.endOfParagraph(p);
 
-	ParC->setText(tmp.setNum(Editor->StyledText.nrOfParagraphs()));
-	CharC2->setText(tmp.setNum(Editor->StyledText.length()));
+	int paragraphCount = Editor->StyledText.nrOfParagraphs();
+	ParC->setText(tmp.setNum(paragraphCount));
 	CharC->setText(tmp.setNum(end - start));
 
 	QRegExp rx( "(\\w+)\\b" );
 	const QString& txt(Editor->StyledText.text(0, Editor->StyledText.length()));
 	int counter  = 0;
 	int counter2 = 0;
+
+	int realCharCount = Editor->StyledText.length();
+	int parSepCount   = paragraphCount;
+	if ((realCharCount > 0) && (!txt.endsWith(SpecialChars::PARSEP)))
+		parSepCount -= 1;
+	CharC2->setText(tmp.setNum(realCharCount - parSepCount));
 
 	int pos = rx.indexIn(txt, 0);
 	while (pos >= 0)




More information about the scribus-commit mailing list