diff --git a/CHANGELOG.md b/CHANGELOG.md index d8e082fa..16bb1b32 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -89,6 +89,25 @@ final release. ---- +## 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 disappears 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. +* Back ported a bugfix from 1.7 RC1 that resolves an issue with the text cursor sometimes +disappearing at the right-hand edge of the text editor. Issues #1112 and #1119. PR #1120. + +---- + ## Version 1.6.3 [2022-08-18] ### Release Notes diff --git a/novelwriter/gui/doceditor.py b/novelwriter/gui/doceditor.py index b1274f34..134b2e1c 100644 --- a/novelwriter/gui/doceditor.py +++ b/novelwriter/gui/doceditor.py @@ -1994,12 +1994,12 @@ class GuiDocEditor(QTextEdit): 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 diff --git a/tests/reference/guiEditor_Main_Final_000000000000f.nwd b/tests/reference/guiEditor_Main_Final_000000000000f.nwd index fcab1110..1ac700fb 100644 --- a/tests/reference/guiEditor_Main_Final_000000000000f.nwd +++ b/tests/reference/guiEditor_Main_Final_000000000000f.nwd @@ -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” diff --git a/tests/reference/guiEditor_Main_Final_nwProject.nwx b/tests/reference/guiEditor_Main_Final_nwProject.nwx index 884ab272..5496b5b3 100644 --- a/tests/reference/guiEditor_Main_Final_nwProject.nwx +++ b/tests/reference/guiEditor_Main_Final_nwProject.nwx @@ -1,12 +1,12 @@ - + New Project New Novel Jane Doe 4 2 - 3 + 4 True @@ -17,8 +17,8 @@ None 0000000000008 0000000000008 - 129 - 102 + 145 + 118 27 @@ -59,7 +59,7 @@ New Chapter - + New Scene diff --git a/tests/test_gui/test_gui_guimain.py b/tests/test_gui/test_gui_guimain.py index bcda180c..b2e446bc 100644 --- a/tests/test_gui/test_gui_guimain.py +++ b/tests/test_gui/test_gui_guimain.py @@ -373,6 +373,9 @@ def testGuiMain_Editing(qtbot, monkeypatch, nwGUI, fncProj, refDir, outDir, mock 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! " @@ -406,6 +409,41 @@ def testGuiMain_Editing(qtbot, monkeypatch, nwGUI, fncProj, refDir, outDir, mock 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)