@@ -53,10 +53,10 @@ class NWItem:
5353 """
5454
5555 __slots__ = (
56- "_active" , "_charCount" , "_class " , "_cursorPos " , "_expanded " ,
57- "_handle " , "_heading " , "_import " , "_initCount " , "_layout" , "_name" ,
56+ "_active" , "_charCount" , "_charInit " , "_class " , "_cursorPos " ,
57+ "_expanded " , "_handle " , "_heading " , "_import " , "_layout" , "_name" ,
5858 "_order" , "_paraCount" , "_parent" , "_project" , "_root" , "_status" ,
59- "_type" , "_wordCount" ,
59+ "_type" , "_wordCount" , "_wordInit" ,
6060 )
6161
6262 def __init__ (self , project : NWProject , handle : str ) -> None :
@@ -81,7 +81,8 @@ def __init__(self, project: NWProject, handle: str) -> None:
8181 self ._wordCount = 0 # Current word count
8282 self ._paraCount = 0 # Current paragraph count
8383 self ._cursorPos = 0 # Last cursor position
84- self ._initCount = 0 # Initial word count
84+ self ._wordInit = 0 # Initial character count
85+ self ._charInit = 0 # Initial word count
8586
8687 return
8788
@@ -164,9 +165,13 @@ def wordCount(self) -> int:
164165 def paraCount (self ) -> int :
165166 return self ._paraCount
166167
168+ @property
169+ def mainCount (self ) -> int :
170+ return self ._charCount if CONFIG .useCharCount else self ._wordCount
171+
167172 @property
168173 def initCount (self ) -> int :
169- return self ._initCount
174+ return self ._wordInit if CONFIG . useCharCount else self . _charInit
170175
171176 @property
172177 def cursorPos (self ) -> int :
@@ -257,31 +262,33 @@ def unpack(self, data: dict) -> bool:
257262 self ._paraCount = 0
258263 self ._cursorPos = 0
259264
260- self ._initCount = self ._wordCount
265+ self ._wordInit = self ._charCount
266+ self ._charInit = self ._wordCount
261267
262268 return True
263269
264270 @classmethod
265271 def duplicate (cls , source : NWItem , handle : str ) -> NWItem :
266272 """Make a copy of an item."""
267273 new = cls (source ._project , handle )
268- new ._name = source ._name
269- new ._parent = source ._parent
270- new ._root = source ._root
271- new ._order = source ._order
272- new ._type = source ._type
273- new ._class = source ._class
274- new ._layout = source ._layout
275- new ._status = source ._status
276- new ._import = source ._import
277- new ._active = source ._active
278- new ._expanded = source ._expanded
279- new ._heading = source ._heading
280- new ._charCount = source ._charCount
281- new ._wordCount = source ._wordCount
282- new ._paraCount = source ._paraCount
283- new ._cursorPos = source ._cursorPos
284- new ._initCount = source ._initCount
274+ new ._name = source ._name
275+ new ._parent = source ._parent
276+ new ._root = source ._root
277+ new ._order = source ._order
278+ new ._type = source ._type
279+ new ._class = source ._class
280+ new ._layout = source ._layout
281+ new ._status = source ._status
282+ new ._import = source ._import
283+ new ._active = source ._active
284+ new ._expanded = source ._expanded
285+ new ._heading = source ._heading
286+ new ._charCount = source ._charCount
287+ new ._wordCount = source ._wordCount
288+ new ._paraCount = source ._paraCount
289+ new ._cursorPos = source ._cursorPos
290+ new ._wordInit = source ._wordInit
291+ new ._charInit = source ._charInit
285292 return new
286293
287294 ##
0 commit comments