diff --git a/CHANGELOG.md b/CHANGELOG.md index 1c864ca1..00509e4e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,12 +1,37 @@ # novelWriter Changelog +## Version 1.6.2 [2022-03-20] + +### Release Notes + +This is a bugfix release that fixes a couple of minor issues. Projects containing one or more empty +documents would trigger a rebuild of the index each time the project was opened. This has now been +fixed. Another fix resolves an error message being written to the console logging output when a new +document was created. Both errors were harmless. + +### Detailed Changelog + +**Bugfixes** + +* Fixed an issue where projects containing empty documents would trigger an index rebuild on open, + but the empty document would be skipped due to a check that skips empty documents. As a + consequence, the index would be rebuilt each time the project was opened. Empty documents are now + added to the index, resolving this issue. Issue #1020. PR #1022. +* Fixed an issue where the shasum calculation would be performed when a new document was created, + which would fail as the file did not yet exist. The error was handled, but an error message was + printed to the console log. The shasum is now no longer called if the file doesn't already exist. + Issue #1021. PR #1023. + +---- + ## Version 1.6.1 [2022-03-16] ### Release Notes -This is a bugfix and patch release that fixes two recursion/loop issues. One can cause a crash if -the window is resized rapidly, and one can cause a hang with certain search parameters in the -editor's search box. The Latin American Spanish translation has also been updated. +This is a bugfix and patch release that fixes two recursion/loop issues. One would potentially +cause a crash if the window was resized rapidly, and one would cause a hang with certain search +parameters in the editor's search box. The Latin American Spanish translation has also been +updated. ### Detailed Changelog diff --git a/novelwriter/assets/text/release_notes.htm b/novelwriter/assets/text/release_notes.htm index 6c4a7d99..0850e30c 100644 --- a/novelwriter/assets/text/release_notes.htm +++ b/novelwriter/assets/text/release_notes.htm @@ -41,9 +41,17 @@ not compatible.

Patch 1.6.1 – 16 March 2022

-

This is a bugfix and patch release that fixes two recursion/loop issues. One can cause a crash -if the window is resized rapidly, and one can cause a hang with certain search parameters in the -editor's search box. The Latin American Spanish translation has also been updated.

+

This is a bugfix and patch release that fixes two recursion/loop issues. One would potentially +cause a crash if the window was resized rapidly, and one would cause a hang with certain search +parameters in the editor's search box. The Latin American Spanish translation has also been +updated.

+ +

Patch 1.6.2 – 20 March 2022

+ +

This is a bugfix release that fixes a couple of minor issues. Projects containing one or more +empty documents would trigger a rebuild of the index each time the project was opened. This has now +been fixed. Another fix resolves an error message being written to the console logging output when +a new document was created. Both errors were harmless.

diff --git a/novelwriter/core/document.py b/novelwriter/core/document.py index 71916af8..2334c77c 100644 --- a/novelwriter/core/document.py +++ b/novelwriter/core/document.py @@ -89,9 +89,10 @@ class NWDoc(): theText = "" self._docMeta = {} - self._prevHash = sha256sum(docPath) + self._prevHash = None if os.path.isfile(docPath): + self._prevHash = sha256sum(docPath) try: with open(docPath, mode="r", encoding="utf-8") as inFile: # Check the first <= 10 lines for metadata diff --git a/novelwriter/core/index.py b/novelwriter/core/index.py index fa4f01dd..b05fa952 100644 --- a/novelwriter/core/index.py +++ b/novelwriter/core/index.py @@ -112,8 +112,7 @@ class NWIndex(): theDoc = NWDoc(self.theProject, tHandle) theText = theDoc.readDocument() - if theText: - self.scanText(tHandle, theText) + self.scanText(tHandle, theText if theText is not None else "") return True @@ -217,18 +216,19 @@ class NWIndex(): if theItem.itemType != nwItemType.FILE: logger.info("Not indexing non-file item '%s'", tHandle) return False + + # Run word counter for the whole text + cC, wC, pC = countWords(theText) + self._fileMeta[tHandle] = ["H0", cC, wC, pC] + + # If the file's meta data is missing, or the file is out of the + # main project, we don't index the content if theItem.itemLayout == nwItemLayout.NO_LAYOUT: logger.info("Not indexing no-layout item '%s'", tHandle) return False if theItem.itemParent is None: logger.info("Not indexing orphaned item '%s'", tHandle) return False - - # Run word counter for the whole text - cC, wC, pC = countWords(theText) - self._fileMeta[tHandle] = ["H0", cC, wC, pC] - - # If the file is archived or in trash, we don't index the content if self.theProject.projTree.isTrashRoot(theItem.itemParent): logger.debug("Not indexing trash item '%s'", tHandle) return False