Skip to content

Commit c04715c

Browse files
authored
Release 1.6.4 (#1120)
2 parents 802d1b0 + d82c739 commit c04715c

File tree

8 files changed

+97
-24
lines changed

8 files changed

+97
-24
lines changed

CHANGELOG.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,24 @@
11
# novelWriter Changelog
22

3+
## Version 1.6.4 [2022-09-29]
4+
5+
### Release Notes
6+
7+
This is a bugfix release that fixes a critical bug in the insert non-breaking spaces feature. It
8+
basically no longer worked in the 1.6.3 release. This release also fixes a minor issue where the
9+
text cursor sometimes dissappears when reaching the right-hand edge of the text editor window.
10+
11+
### Detailed Changelog
12+
13+
**Bugfixes**
14+
15+
* Fixed a bug in the auto-replace feature of the editor that caused a crash when using the insert
16+
non-breaking spaces feature was used. Issue #1118. PR #1120.
17+
* Backported a bugfix from 1.7 RC1 that resolves an issue with the text cursor sometimes
18+
dissappearing at the right-hand edge of the text editor. Issues #1112 and #1119. PR #1120.
19+
20+
----
21+
322
## Version 1.6.3 [2022-08-18]
423

524
### Release Notes

novelwriter/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@
6060
__author__ = "Veronica Berglyd Olsen"
6161
__maintainer__ = "Veronica Berglyd Olsen"
6262
__email__ = "[email protected]"
63-
__version__ = "1.6.3"
64-
__hexversion__ = "0x010603f0"
65-
__date__ = "2022-08-18"
63+
__version__ = "1.6.4"
64+
__hexversion__ = "0x010604f0"
65+
__date__ = "2022-09-29"
6666
__status__ = "Stable"
6767
__domain__ = "novelwriter.io"
6868
__url__ = "https://novelwriter.io"

novelwriter/assets/text/release_notes.htm

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,5 +64,11 @@ <h3>Patch 1.6.3 &ndash; 18 August 2022</h3>
6464
disappears. It was not necessarily obvious how the viewer panel could be restored in such cases.
6565
</p>
6666

67+
<h3>Patch 1.6.4 &ndash; 29 September 2022</h3>
68+
69+
<p>This is a bugfix release that fixes a critical bug in the insert non-breaking spaces feature. It
70+
basically no longer worked in the 1.6.3 release. This release also fixes a minor issue where the
71+
text cursor sometimes dissappears when reaching the right-hand edge of the text editor window.</p>
72+
6773
</body>
6874
</html>

novelwriter/gui/doceditor.py

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ def __init__(self, theParent):
9191

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

9596
# Document Variables
9697
self._charCount = 0 # Character count
@@ -268,10 +269,12 @@ def initEditor(self):
268269
self.docHeader.matchColours()
269270
self.docFooter.matchColours()
270271

271-
# Set default text margins
272-
cM = self.mainConf.getTextMargin()
273-
qDoc.setDocumentMargin(0)
274-
self.setViewportMargins(cM, cM, cM, cM)
272+
# Due to cursor visibility, a part of the margin must be
273+
# allocated to the document itself. See issue #1112.
274+
cW = self.cursorWidth()
275+
qDoc.setDocumentMargin(cW)
276+
self._vpMargin = max(self.mainConf.getTextMargin() - cW, 0)
277+
self.setViewportMargins(self._vpMargin, self._vpMargin, self._vpMargin, self._vpMargin)
275278

276279
# Also set the document text options for the document text flow
277280
theOpt = QTextOption()
@@ -533,18 +536,17 @@ def updateDocMargins(self):
533536
"""
534537
wW = self.width()
535538
wH = self.height()
536-
cM = self.mainConf.getTextMargin()
537539

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

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

544-
tM = cM
546+
tM = self._vpMargin
545547
if self.mainConf.textWidth > 0 or self.theParent.isFocusMode:
546548
tW = self.mainConf.getTextWidth(self.theParent.isFocusMode)
547-
tM = max((wW - sW - tW)//2, cM)
549+
tM = max((wW - sW - tW)//2, self._vpMargin)
548550

549551
tB = self.frameWidth()
550552
tW = wW - 2*tB - sW
@@ -561,8 +563,8 @@ def updateDocMargins(self):
561563
rL = wW - sW - rW - 2*tB
562564
self.docSearch.move(rL, 2*tB)
563565

564-
uM = max(cM, tH, rH)
565-
lM = max(cM, fH)
566+
uM = max(self._vpMargin, tH, rH)
567+
lM = max(self._vpMargin, fH)
566568
self.setViewportMargins(tM, uM, tM, lM)
567569

568570
return
@@ -1982,12 +1984,12 @@ def _docAutoReplace(self, theBlock):
19821984

19831985
tCheck = tInsert
19841986
if tCheck in self.mainConf.fmtPadBefore:
1985-
if self.allowSpaceBeforeColon(theText, tCheck):
1987+
if self._allowSpaceBeforeColon(theText, tCheck):
19861988
nDelete = max(nDelete, 1)
19871989
tInsert = self._typPadChar + tInsert
19881990

19891991
if tCheck in self.mainConf.fmtPadAfter:
1990-
if self.allowSpaceBeforeColon(theText, tCheck):
1992+
if self._allowSpaceBeforeColon(theText, tCheck):
19911993
nDelete = max(nDelete, 1)
19921994
tInsert = tInsert + self._typPadChar
19931995

sample/nwProject.nwx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<?xml version='1.0' encoding='utf-8'?>
2-
<novelWriterXML appVersion="1.6.2" hexVersion="0x010602f0" fileVersion="1.3" timeStamp="2022-08-18 20:38:04">
2+
<novelWriterXML appVersion="1.6.4" hexVersion="0x010604f0" fileVersion="1.3" timeStamp="2022-09-29 19:23:00">
33
<project>
44
<name>Sample Project</name>
55
<title>Sample Project</title>
66
<author>Jane Smith</author>
77
<author>Jay Doh</author>
8-
<saveCount>1304</saveCount>
8+
<saveCount>1305</saveCount>
99
<autoCount>199</autoCount>
10-
<editTime>65055</editTime>
10+
<editTime>65071</editTime>
1111
</project>
1212
<settings>
1313
<doBackup>False</doBackup>

tests/reference/guiEditor_Main_Final_0e17daca5f3e1.nwd

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,14 @@ This is another paragraph of much longer nonsense text. It is in fact 1 very ver
2727

2828
‘Full line single quoted text.’
2929

30+
Some “ double quoted text with spaces padded ”.
31+
32+
@object: NoSpaceAdded
33+
34+
% synopsis: No space before this colon.
35+
36+
Add space before this colon : See?
37+
3038
“Tab-indented text”
3139

3240
>“Paragraph-indented text”

tests/reference/guiEditor_Main_Final_nwProject.nwx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version='1.0' encoding='utf-8'?>
2-
<novelWriterXML appVersion="1.5-beta2" hexVersion="0x010500b2" fileVersion="1.3" timeStamp="2021-08-31 00:03:45">
2+
<novelWriterXML appVersion="1.6.3" hexVersion="0x010603f0" fileVersion="1.3" timeStamp="2022-09-29 14:24:23">
33
<project>
44
<name>New Project</name>
55
<title></title>
@@ -15,8 +15,8 @@
1515
<autoOutline>True</autoOutline>
1616
<lastEdited>0e17daca5f3e1</lastEdited>
1717
<lastViewed>None</lastViewed>
18-
<lastWordCount>126</lastWordCount>
19-
<novelWordCount>99</novelWordCount>
18+
<lastWordCount>142</lastWordCount>
19+
<novelWordCount>115</novelWordCount>
2020
<notesWordCount>27</notesWordCount>
2121
<autoReplace/>
2222
<titleFormat>
@@ -85,10 +85,10 @@
8585
<status>New</status>
8686
<exported>True</exported>
8787
<layout>DOCUMENT</layout>
88-
<charCount>612</charCount>
89-
<wordCount>95</wordCount>
90-
<paraCount>10</paraCount>
91-
<cursorPos>768</cursorPos>
88+
<charCount>693</charCount>
89+
<wordCount>111</wordCount>
90+
<paraCount>12</paraCount>
91+
<cursorPos>917</cursorPos>
9292
</item>
9393
<item handle="44cb730c42048" order="1" parent="None">
9494
<name>Plot</name>

tests/test_gui/test_gui_guimain.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,9 @@ def testGuiMain_Editing(qtbot, monkeypatch, nwGUI, fncProj, refDir, outDir):
340340
qtbot.keyClick(nwGUI.docEditor, Qt.Key_Return, delay=keyDelay)
341341
qtbot.keyClick(nwGUI.docEditor, Qt.Key_Return, delay=keyDelay)
342342

343+
# Auto-Replace
344+
# ============
345+
343346
for c in (
344347
"This is another paragraph of much longer nonsense text. "
345348
"It is in fact 1 very very NONSENSICAL nonsense text! "
@@ -373,6 +376,41 @@ def testGuiMain_Editing(qtbot, monkeypatch, nwGUI, fncProj, refDir, outDir):
373376
qtbot.keyClick(nwGUI.docEditor, Qt.Key_Return, delay=keyDelay)
374377
qtbot.keyClick(nwGUI.docEditor, Qt.Key_Return, delay=keyDelay)
375378

379+
# Insert spaces before and after quotes
380+
nwGUI.mainConf.fmtPadBefore = "\u201d"
381+
nwGUI.mainConf.fmtPadAfter = "\u201c"
382+
383+
for c in "Some \"double quoted text with spaces padded\".":
384+
qtbot.keyClick(nwGUI.docEditor, c, delay=typeDelay)
385+
qtbot.keyClick(nwGUI.docEditor, Qt.Key_Return, delay=keyDelay)
386+
qtbot.keyClick(nwGUI.docEditor, Qt.Key_Return, delay=keyDelay)
387+
388+
nwGUI.mainConf.fmtPadBefore = ""
389+
nwGUI.mainConf.fmtPadAfter = ""
390+
391+
# Insert spaces before colon, but ignore tags and synopsis
392+
nwGUI.mainConf.fmtPadBefore = ":"
393+
394+
for c in "@object: NoSpaceAdded":
395+
qtbot.keyClick(nwGUI.docEditor, c, delay=typeDelay)
396+
qtbot.keyClick(nwGUI.docEditor, Qt.Key_Return, delay=keyDelay)
397+
qtbot.keyClick(nwGUI.docEditor, Qt.Key_Return, delay=keyDelay)
398+
399+
for c in "% synopsis: No space before this colon.":
400+
qtbot.keyClick(nwGUI.docEditor, c, delay=typeDelay)
401+
qtbot.keyClick(nwGUI.docEditor, Qt.Key_Return, delay=keyDelay)
402+
qtbot.keyClick(nwGUI.docEditor, Qt.Key_Return, delay=keyDelay)
403+
404+
for c in "Add space before this colon: See?":
405+
qtbot.keyClick(nwGUI.docEditor, c, delay=typeDelay)
406+
qtbot.keyClick(nwGUI.docEditor, Qt.Key_Return, delay=keyDelay)
407+
qtbot.keyClick(nwGUI.docEditor, Qt.Key_Return, delay=keyDelay)
408+
409+
nwGUI.mainConf.fmtPadBefore = ""
410+
411+
# Indent and Align
412+
# ================
413+
376414
for c in "\t\"Tab-indented text\"":
377415
qtbot.keyClick(nwGUI.docEditor, c, delay=typeDelay)
378416
qtbot.keyClick(nwGUI.docEditor, Qt.Key_Return, delay=keyDelay)

0 commit comments

Comments
 (0)