Merge 1.6.2 (#1025)

This commit is contained in:
Veronica Berglyd Olsen
2022-03-20 16:04:18 +01:00
committed by GitHub
4 changed files with 49 additions and 15 deletions
+28 -3
View File
@@ -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
+11 -3
View File
@@ -41,9 +41,17 @@ not compatible.</p>
<h3>Patch 1.6.1 &ndash; 16 March 2022</h3>
<p>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.</p>
<p>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.</p>
<h3>Patch 1.6.2 &ndash; 20 March 2022</h3>
<p>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.</p>
</body>
</html>
+2 -1
View File
@@ -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
+8 -8
View File
@@ -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