Release 1.6.4 (#1120)

This commit is contained in:
Veronica Berglyd Olsen
2022-09-29 19:27:02 +02:00
committed by GitHub
8 changed files with 97 additions and 24 deletions
+19
View File
@@ -1,5 +1,24 @@
# novelWriter Changelog # novelWriter Changelog
## Version 1.6.4 [2022-09-29]
### Release Notes
This is a bugfix release that fixes a critical bug in the insert non-breaking spaces feature. It
basically no longer worked in the 1.6.3 release. This release also fixes a minor issue where the
text cursor sometimes dissappears when reaching the right-hand edge of the text editor window.
### Detailed Changelog
**Bugfixes**
* Fixed a bug in the auto-replace feature of the editor that caused a crash when using the insert
non-breaking spaces feature was used. Issue #1118. PR #1120.
* Backported a bugfix from 1.7 RC1 that resolves an issue with the text cursor sometimes
dissappearing at the right-hand edge of the text editor. Issues #1112 and #1119. PR #1120.
----
## Version 1.6.3 [2022-08-18] ## Version 1.6.3 [2022-08-18]
### Release Notes ### Release Notes
+3 -3
View File
@@ -60,9 +60,9 @@ __license__ = "GPLv3"
__author__ = "Veronica Berglyd Olsen" __author__ = "Veronica Berglyd Olsen"
__maintainer__ = "Veronica Berglyd Olsen" __maintainer__ = "Veronica Berglyd Olsen"
__email__ = "code@vkbo.net" __email__ = "code@vkbo.net"
__version__ = "1.6.3" __version__ = "1.6.4"
__hexversion__ = "0x010603f0" __hexversion__ = "0x010604f0"
__date__ = "2022-08-18" __date__ = "2022-09-29"
__status__ = "Stable" __status__ = "Stable"
__domain__ = "novelwriter.io" __domain__ = "novelwriter.io"
__url__ = "https://novelwriter.io" __url__ = "https://novelwriter.io"
@@ -64,5 +64,11 @@ the slider splitting the editor and viewer panels can no longer be dragged until
disappears. It was not necessarily obvious how the viewer panel could be restored in such cases. disappears. It was not necessarily obvious how the viewer panel could be restored in such cases.
</p> </p>
<h3>Patch 1.6.4 &ndash; 29 September 2022</h3>
<p>This is a bugfix release that fixes a critical bug in the insert non-breaking spaces feature. It
basically no longer worked in the 1.6.3 release. This release also fixes a minor issue where the
text cursor sometimes dissappears when reaching the right-hand edge of the text editor window.</p>
</body> </body>
</html> </html>
+13 -11
View File
@@ -91,6 +91,7 @@ class GuiDocEditor(QTextEdit):
self._spellCheck = False # Flag for spell checking enabled self._spellCheck = False # Flag for spell checking enabled
self._nonWord = "\"'" # Characters to not include in spell checking self._nonWord = "\"'" # Characters to not include in spell checking
self._vpMargin = 0 # The editor viewport margin, set during init
# Document Variables # Document Variables
self._charCount = 0 # Character count self._charCount = 0 # Character count
@@ -268,10 +269,12 @@ class GuiDocEditor(QTextEdit):
self.docHeader.matchColours() self.docHeader.matchColours()
self.docFooter.matchColours() self.docFooter.matchColours()
# Set default text margins # Due to cursor visibility, a part of the margin must be
cM = self.mainConf.getTextMargin() # allocated to the document itself. See issue #1112.
qDoc.setDocumentMargin(0) cW = self.cursorWidth()
self.setViewportMargins(cM, cM, cM, cM) qDoc.setDocumentMargin(cW)
self._vpMargin = max(self.mainConf.getTextMargin() - cW, 0)
self.setViewportMargins(self._vpMargin, self._vpMargin, self._vpMargin, self._vpMargin)
# Also set the document text options for the document text flow # Also set the document text options for the document text flow
theOpt = QTextOption() theOpt = QTextOption()
@@ -533,7 +536,6 @@ class GuiDocEditor(QTextEdit):
""" """
wW = self.width() wW = self.width()
wH = self.height() wH = self.height()
cM = self.mainConf.getTextMargin()
vBar = self.verticalScrollBar() vBar = self.verticalScrollBar()
sW = vBar.width() if vBar.isVisible() else 0 sW = vBar.width() if vBar.isVisible() else 0
@@ -541,10 +543,10 @@ class GuiDocEditor(QTextEdit):
hBar = self.horizontalScrollBar() hBar = self.horizontalScrollBar()
sH = hBar.height() if hBar.isVisible() else 0 sH = hBar.height() if hBar.isVisible() else 0
tM = cM tM = self._vpMargin
if self.mainConf.textWidth > 0 or self.theParent.isFocusMode: if self.mainConf.textWidth > 0 or self.theParent.isFocusMode:
tW = self.mainConf.getTextWidth(self.theParent.isFocusMode) tW = self.mainConf.getTextWidth(self.theParent.isFocusMode)
tM = max((wW - sW - tW)//2, cM) tM = max((wW - sW - tW)//2, self._vpMargin)
tB = self.frameWidth() tB = self.frameWidth()
tW = wW - 2*tB - sW tW = wW - 2*tB - sW
@@ -561,8 +563,8 @@ class GuiDocEditor(QTextEdit):
rL = wW - sW - rW - 2*tB rL = wW - sW - rW - 2*tB
self.docSearch.move(rL, 2*tB) self.docSearch.move(rL, 2*tB)
uM = max(cM, tH, rH) uM = max(self._vpMargin, tH, rH)
lM = max(cM, fH) lM = max(self._vpMargin, fH)
self.setViewportMargins(tM, uM, tM, lM) self.setViewportMargins(tM, uM, tM, lM)
return return
@@ -1982,12 +1984,12 @@ class GuiDocEditor(QTextEdit):
tCheck = tInsert tCheck = tInsert
if tCheck in self.mainConf.fmtPadBefore: if tCheck in self.mainConf.fmtPadBefore:
if self.allowSpaceBeforeColon(theText, tCheck): if self._allowSpaceBeforeColon(theText, tCheck):
nDelete = max(nDelete, 1) nDelete = max(nDelete, 1)
tInsert = self._typPadChar + tInsert tInsert = self._typPadChar + tInsert
if tCheck in self.mainConf.fmtPadAfter: if tCheck in self.mainConf.fmtPadAfter:
if self.allowSpaceBeforeColon(theText, tCheck): if self._allowSpaceBeforeColon(theText, tCheck):
nDelete = max(nDelete, 1) nDelete = max(nDelete, 1)
tInsert = tInsert + self._typPadChar tInsert = tInsert + self._typPadChar
+3 -3
View File
@@ -1,13 +1,13 @@
<?xml version='1.0' encoding='utf-8'?> <?xml version='1.0' encoding='utf-8'?>
<novelWriterXML appVersion="1.6.2" hexVersion="0x010602f0" fileVersion="1.3" timeStamp="2022-08-18 20:38:04"> <novelWriterXML appVersion="1.6.4" hexVersion="0x010604f0" fileVersion="1.3" timeStamp="2022-09-29 19:23:00">
<project> <project>
<name>Sample Project</name> <name>Sample Project</name>
<title>Sample Project</title> <title>Sample Project</title>
<author>Jane Smith</author> <author>Jane Smith</author>
<author>Jay Doh</author> <author>Jay Doh</author>
<saveCount>1304</saveCount> <saveCount>1305</saveCount>
<autoCount>199</autoCount> <autoCount>199</autoCount>
<editTime>65055</editTime> <editTime>65071</editTime>
</project> </project>
<settings> <settings>
<doBackup>False</doBackup> <doBackup>False</doBackup>
@@ -27,6 +27,14 @@ This is another paragraph of much longer nonsense text. It is in fact 1 very ver
Full line single quoted text. Full line single quoted text.
Some “ double quoted text with spaces padded ”.
@object: NoSpaceAdded
% synopsis: No space before this colon.
Add space before this colon : See?
“Tab-indented text” “Tab-indented text”
>“Paragraph-indented text” >“Paragraph-indented text”
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?> <?xml version='1.0' encoding='utf-8'?>
<novelWriterXML appVersion="1.5-beta2" hexVersion="0x010500b2" fileVersion="1.3" timeStamp="2021-08-31 00:03:45"> <novelWriterXML appVersion="1.6.3" hexVersion="0x010603f0" fileVersion="1.3" timeStamp="2022-09-29 14:24:23">
<project> <project>
<name>New Project</name> <name>New Project</name>
<title></title> <title></title>
@@ -15,8 +15,8 @@
<autoOutline>True</autoOutline> <autoOutline>True</autoOutline>
<lastEdited>0e17daca5f3e1</lastEdited> <lastEdited>0e17daca5f3e1</lastEdited>
<lastViewed>None</lastViewed> <lastViewed>None</lastViewed>
<lastWordCount>126</lastWordCount> <lastWordCount>142</lastWordCount>
<novelWordCount>99</novelWordCount> <novelWordCount>115</novelWordCount>
<notesWordCount>27</notesWordCount> <notesWordCount>27</notesWordCount>
<autoReplace/> <autoReplace/>
<titleFormat> <titleFormat>
@@ -85,10 +85,10 @@
<status>New</status> <status>New</status>
<exported>True</exported> <exported>True</exported>
<layout>DOCUMENT</layout> <layout>DOCUMENT</layout>
<charCount>612</charCount> <charCount>693</charCount>
<wordCount>95</wordCount> <wordCount>111</wordCount>
<paraCount>10</paraCount> <paraCount>12</paraCount>
<cursorPos>768</cursorPos> <cursorPos>917</cursorPos>
</item> </item>
<item handle="44cb730c42048" order="1" parent="None"> <item handle="44cb730c42048" order="1" parent="None">
<name>Plot</name> <name>Plot</name>
+38
View File
@@ -340,6 +340,9 @@ def testGuiMain_Editing(qtbot, monkeypatch, nwGUI, fncProj, refDir, outDir):
qtbot.keyClick(nwGUI.docEditor, Qt.Key_Return, delay=keyDelay) qtbot.keyClick(nwGUI.docEditor, Qt.Key_Return, delay=keyDelay)
qtbot.keyClick(nwGUI.docEditor, Qt.Key_Return, delay=keyDelay) qtbot.keyClick(nwGUI.docEditor, Qt.Key_Return, delay=keyDelay)
# Auto-Replace
# ============
for c in ( for c in (
"This is another paragraph of much longer nonsense text. " "This is another paragraph of much longer nonsense text. "
"It is in fact 1 very very NONSENSICAL nonsense text! " "It is in fact 1 very very NONSENSICAL nonsense text! "
@@ -373,6 +376,41 @@ def testGuiMain_Editing(qtbot, monkeypatch, nwGUI, fncProj, refDir, outDir):
qtbot.keyClick(nwGUI.docEditor, Qt.Key_Return, delay=keyDelay) qtbot.keyClick(nwGUI.docEditor, Qt.Key_Return, delay=keyDelay)
qtbot.keyClick(nwGUI.docEditor, Qt.Key_Return, delay=keyDelay) qtbot.keyClick(nwGUI.docEditor, Qt.Key_Return, delay=keyDelay)
# Insert spaces before and after quotes
nwGUI.mainConf.fmtPadBefore = "\u201d"
nwGUI.mainConf.fmtPadAfter = "\u201c"
for c in "Some \"double quoted text with spaces padded\".":
qtbot.keyClick(nwGUI.docEditor, c, delay=typeDelay)
qtbot.keyClick(nwGUI.docEditor, Qt.Key_Return, delay=keyDelay)
qtbot.keyClick(nwGUI.docEditor, Qt.Key_Return, delay=keyDelay)
nwGUI.mainConf.fmtPadBefore = ""
nwGUI.mainConf.fmtPadAfter = ""
# Insert spaces before colon, but ignore tags and synopsis
nwGUI.mainConf.fmtPadBefore = ":"
for c in "@object: NoSpaceAdded":
qtbot.keyClick(nwGUI.docEditor, c, delay=typeDelay)
qtbot.keyClick(nwGUI.docEditor, Qt.Key_Return, delay=keyDelay)
qtbot.keyClick(nwGUI.docEditor, Qt.Key_Return, delay=keyDelay)
for c in "% synopsis: No space before this colon.":
qtbot.keyClick(nwGUI.docEditor, c, delay=typeDelay)
qtbot.keyClick(nwGUI.docEditor, Qt.Key_Return, delay=keyDelay)
qtbot.keyClick(nwGUI.docEditor, Qt.Key_Return, delay=keyDelay)
for c in "Add space before this colon: See?":
qtbot.keyClick(nwGUI.docEditor, c, delay=typeDelay)
qtbot.keyClick(nwGUI.docEditor, Qt.Key_Return, delay=keyDelay)
qtbot.keyClick(nwGUI.docEditor, Qt.Key_Return, delay=keyDelay)
nwGUI.mainConf.fmtPadBefore = ""
# Indent and Align
# ================
for c in "\t\"Tab-indented text\"": for c in "\t\"Tab-indented text\"":
qtbot.keyClick(nwGUI.docEditor, c, delay=typeDelay) qtbot.keyClick(nwGUI.docEditor, c, delay=typeDelay)
qtbot.keyClick(nwGUI.docEditor, Qt.Key_Return, delay=keyDelay) qtbot.keyClick(nwGUI.docEditor, Qt.Key_Return, delay=keyDelay)