Skip to content

Commit

Permalink
Release 1.6.4 (#1120)
Browse files Browse the repository at this point in the history
  • Loading branch information
vkbo authored Sep 29, 2022
2 parents 802d1b0 + d82c739 commit c04715c
Show file tree
Hide file tree
Showing 8 changed files with 97 additions and 24 deletions.
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
# 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]

### Release Notes
Expand Down
6 changes: 3 additions & 3 deletions novelwriter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@
__author__ = "Veronica Berglyd Olsen"
__maintainer__ = "Veronica Berglyd Olsen"
__email__ = "[email protected]"
__version__ = "1.6.3"
__hexversion__ = "0x010603f0"
__date__ = "2022-08-18"
__version__ = "1.6.4"
__hexversion__ = "0x010604f0"
__date__ = "2022-09-29"
__status__ = "Stable"
__domain__ = "novelwriter.io"
__url__ = "https://novelwriter.io"
Expand Down
6 changes: 6 additions & 0 deletions novelwriter/assets/text/release_notes.htm
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,11 @@ <h3>Patch 1.6.3 &ndash; 18 August 2022</h3>
disappears. It was not necessarily obvious how the viewer panel could be restored in such cases.
</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>
</html>
24 changes: 13 additions & 11 deletions novelwriter/gui/doceditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ def __init__(self, theParent):

self._spellCheck = False # Flag for spell checking enabled
self._nonWord = "\"'" # Characters to not include in spell checking
self._vpMargin = 0 # The editor viewport margin, set during init

# Document Variables
self._charCount = 0 # Character count
Expand Down Expand Up @@ -268,10 +269,12 @@ def initEditor(self):
self.docHeader.matchColours()
self.docFooter.matchColours()

# Set default text margins
cM = self.mainConf.getTextMargin()
qDoc.setDocumentMargin(0)
self.setViewportMargins(cM, cM, cM, cM)
# Due to cursor visibility, a part of the margin must be
# allocated to the document itself. See issue #1112.
cW = self.cursorWidth()
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
theOpt = QTextOption()
Expand Down Expand Up @@ -533,18 +536,17 @@ def updateDocMargins(self):
"""
wW = self.width()
wH = self.height()
cM = self.mainConf.getTextMargin()

vBar = self.verticalScrollBar()
sW = vBar.width() if vBar.isVisible() else 0

hBar = self.horizontalScrollBar()
sH = hBar.height() if hBar.isVisible() else 0

tM = cM
tM = self._vpMargin
if self.mainConf.textWidth > 0 or 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()
tW = wW - 2*tB - sW
Expand All @@ -561,8 +563,8 @@ def updateDocMargins(self):
rL = wW - sW - rW - 2*tB
self.docSearch.move(rL, 2*tB)

uM = max(cM, tH, rH)
lM = max(cM, fH)
uM = max(self._vpMargin, tH, rH)
lM = max(self._vpMargin, fH)
self.setViewportMargins(tM, uM, tM, lM)

return
Expand Down Expand Up @@ -1982,12 +1984,12 @@ def _docAutoReplace(self, theBlock):

tCheck = tInsert
if tCheck in self.mainConf.fmtPadBefore:
if self.allowSpaceBeforeColon(theText, tCheck):
if self._allowSpaceBeforeColon(theText, tCheck):
nDelete = max(nDelete, 1)
tInsert = self._typPadChar + tInsert

if tCheck in self.mainConf.fmtPadAfter:
if self.allowSpaceBeforeColon(theText, tCheck):
if self._allowSpaceBeforeColon(theText, tCheck):
nDelete = max(nDelete, 1)
tInsert = tInsert + self._typPadChar

Expand Down
6 changes: 3 additions & 3 deletions sample/nwProject.nwx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?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>
<name>Sample Project</name>
<title>Sample Project</title>
<author>Jane Smith</author>
<author>Jay Doh</author>
<saveCount>1304</saveCount>
<saveCount>1305</saveCount>
<autoCount>199</autoCount>
<editTime>65055</editTime>
<editTime>65071</editTime>
</project>
<settings>
<doBackup>False</doBackup>
Expand Down
8 changes: 8 additions & 0 deletions tests/reference/guiEditor_Main_Final_0e17daca5f3e1.nwd
Original file line number Diff line number Diff line change
Expand Up @@ -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.’

Some “ double quoted text with spaces padded ”.

@object: NoSpaceAdded

% synopsis: No space before this colon.

Add space before this colon : See?

“Tab-indented text”

>“Paragraph-indented text”
Expand Down
14 changes: 7 additions & 7 deletions tests/reference/guiEditor_Main_Final_nwProject.nwx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?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>
<name>New Project</name>
<title></title>
Expand All @@ -15,8 +15,8 @@
<autoOutline>True</autoOutline>
<lastEdited>0e17daca5f3e1</lastEdited>
<lastViewed>None</lastViewed>
<lastWordCount>126</lastWordCount>
<novelWordCount>99</novelWordCount>
<lastWordCount>142</lastWordCount>
<novelWordCount>115</novelWordCount>
<notesWordCount>27</notesWordCount>
<autoReplace/>
<titleFormat>
Expand Down Expand Up @@ -85,10 +85,10 @@
<status>New</status>
<exported>True</exported>
<layout>DOCUMENT</layout>
<charCount>612</charCount>
<wordCount>95</wordCount>
<paraCount>10</paraCount>
<cursorPos>768</cursorPos>
<charCount>693</charCount>
<wordCount>111</wordCount>
<paraCount>12</paraCount>
<cursorPos>917</cursorPos>
</item>
<item handle="44cb730c42048" order="1" parent="None">
<name>Plot</name>
Expand Down
38 changes: 38 additions & 0 deletions tests/test_gui/test_gui_guimain.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

# Auto-Replace
# ============

for c in (
"This is another paragraph of much longer nonsense text. "
"It is in fact 1 very very NONSENSICAL nonsense text! "
Expand Down Expand Up @@ -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)

# 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\"":
qtbot.keyClick(nwGUI.docEditor, c, delay=typeDelay)
qtbot.keyClick(nwGUI.docEditor, Qt.Key_Return, delay=keyDelay)
Expand Down

0 comments on commit c04715c

Please sign in to comment.