Skip to content

Commit

Permalink
Move text blocks first also in stats counter as an optimisation
Browse files Browse the repository at this point in the history
  • Loading branch information
vkbo committed May 21, 2024
1 parent 7a13b14 commit dc0ddcf
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions novelwriter/core/tokenizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -926,21 +926,7 @@ def countStats(self) -> None:
nChars = len(tText)
nWChars = len("".join(tWords))

if tType in self.L_HEADINGS:
titleCount += 1
allWords += nWords
titleWords += nWords
allChars += nChars
allWordChars += nWChars
titleChars += nChars
titleWordChars += nWChars

elif tType == self.T_SEP:
allWords += nWords
allChars += nChars
allWordChars += nWChars

elif tType == self.T_TEXT:
if tType == self.T_TEXT:
tPWords = tText.split()
nPWords = len(tPWords)
nPChars = len(tText)
Expand All @@ -954,6 +940,20 @@ def countStats(self) -> None:
allWordChars += nPWChars
textWordChars += nPWChars

elif tType in self.L_HEADINGS:
titleCount += 1
allWords += nWords
titleWords += nWords
allChars += nChars
allWordChars += nWChars
titleChars += nChars
titleWordChars += nWChars

elif tType == self.T_SEP:
allWords += nWords
allChars += nChars
allWordChars += nWChars

elif tType == self.T_SYNOPSIS and self._doSynopsis:
text = "{0}: {1}".format(self._localLookup("Synopsis"), tText)
words = text.split()
Expand Down

0 comments on commit dc0ddcf

Please sign in to comment.