Ever since, Keith explained to me how to view word count, I have been assiduously using it, but the total word count shown for the Drafts folder only shows the correct value if I open up most of the docs in the Drafts folder otherwise it appears to only keep the length of the last couple of docs used.
So I am about 15,000 words into my novel but the total word count shows around 9,000 until I go through the files, view them. Then it shows the right number for a while before the total count drops back down. To be clear: I am not deleting chunks of text, I am adding words instead.
I am keeping Scrivener on the whole time ie not closing the app after use and leaving it in the background. I have an iPad mini running the latest iOS version. I have just looked at my iPhone and it is generating the same (incorrect) stats. This occurred after I opened the iPhone app and a sync was performed.
The session word count appears to be accurate however. It’s the total word count that is hinky. It feels as though the total count is laggy and then is not persistent (although I appreciate this sentence may make little sense).
What happens if you close and reopen the project? The way the word count is calculated is this:
It adds together the total word counts for the documents in the Draft folder (obviously).
If a document has been opened in the editor, its text is open in memory, so the word count is taken from that.
If the document has not been opened in the editor, the word count is taken from the search indexes. (A plain text representation of each text is kept in memory for search purposes.)
When you tap on a document to open it in the editor, it is loaded into memory and kept there until iOS reports high memory usage.
So, it sounds as though something is going wrong in (3), and that the search indexes are out of whack in your project somehow. Closing and reopening the project might clear this if you see a “Rebuilding search indexes” message on reopen. If not, I’d be very grateful if you could share the project with me so that I can take a look.
Let me know if you need more info from me etc - and indeed tell me if you didn’t get the private message as I thought I sent it but I can’t find it in the Outbox nor the Drafts box.
Unfortunately it hasn’t come through. Could you send it to me instead at ios.support AT literatureandlatte.com and make your email FAO Keith? (Be sure to zip it first - the easiest way is just to enter Edit mode in the projects screen, select the project, and then hit the share button at the bottom and choose to email it - that will zip it up for you and attach it to an email automatically.)
Thanks for the project. The problem is as I had thought, but the search indexes are out of whack in the macOS versions of the files. Internally, it works like this:
All the files created on macOS are inside the .scriv package along with a search indexes file containing plain text representations of them (used for searches and quick words counts).
When you edit on iOS, copies of these files are made (or “checked out”) inside the package, which have their own search indexes.
When you return to the Mac, these files are all merged.
This approach means that if you edit on two platforms, you don’t lose data, and Scrivener can examine both versions, keeping both if both have been edited separately.
When iOS grabs the word counts for unopened documents, it grabs the search indexes for all documents. In this case, the problem documents are ones that haven’t been edited on iOS.
Boring technical information aside, here’s how to fix it:
Open the project on your Mac so that it merges all of the changes you’ve made on iOS. At this point, it will rebuild the search indexes automatically, so that when you next open it on iOS, all will be good.
For the next update, I’ve added a “Reset project search indexes” option to the Settings so that if this ever happens, you can fix it on iOS without having to open the project on macOS.
Of course, the question then is, how did this happen in the first place? The search indexes for some of your files do not contain all the text that appears in the files themselves. Right now, I can’t see anything obvious in the file you sent to explain this, although the problem would originated from the Mac version.
I closed and synced the project on iOS and then went to my Mac and waited for Dropbox to update itself. Then I opened Scrivener for Mac and the same project. Initially on open, it gave me a word count of 19456 and a minute or so later it updated to 21910, which is what I reckon the total count is. I rebuilt the search indices on the Mac app.
Then I closed the Mac app and waited for dropbox to sync and opened up the project in iOS but the total started as 14239 and then after waiting and then clicking into a couple of files it increased to 16693 - but no further.
And this may be a red herring, but I noticed in the Mac app that the file in Chapter 2 does not show the word count in the bottom of the window whereas the other files do. If there’s a way to switch this off for an individual file then I’ve accidentally done this - or it may reveal something to you of which I am wholly unaware.
I’m not seeing the word count change like you are after I’ve opened the project on the Mac and re-synced. Once I do that, the word count is stable.
The word count is higher on the Mac, but that is because you have un-ticked “Count documents included in compile only” in the project target options on macOS. When this is un-ticked, the project targets will count everything, even items for which you have deselected “Include in Compile”. This option is not available on iOS, which only ever counts items that are set to be included in Compile. You have turned off “Include in Compile” for the text item in Chapter 4, meaning that it isn’t counted in the iOS version. So you just need to turn that back on. One you do that, and tick “Count documents included in compile only” on the Mac, the word count is the same in both versions. (Well, nearly - there’s a one word difference but there will be very slight variance like that because the iOS version uses slightly different word counting routines, since the more efficient ones used on the Mac are not available in the iOS frameworks.)
As for the word count not being available in Chapter 2, that’s because you have turned on scriptwriting mode for that document (hence the yellow icon), so you just need to turn that off (via the Format menu in macOS, or the inspector in iOS).