diff --git a/nw/convert/text/totext.py b/nw/convert/text/totext.py index 50512d2a..fc21163e 100644 --- a/nw/convert/text/totext.py +++ b/nw/convert/text/totext.py @@ -81,7 +81,7 @@ class ToText(Tokenizer): if tType == self.T_EMPTY: if len(thisPar) > 0: tTemp = " ".join(thisPar) - self.theResult += "%s\n\n" % tTemp.rstrip()) + self.theResult += "%s\n\n" % tTemp.rstrip() thisPar = [] elif tType == self.T_HEAD1: diff --git a/nw/gui/doceditor.py b/nw/gui/doceditor.py index 9c247ae5..03d3313d 100644 --- a/nw/gui/doceditor.py +++ b/nw/gui/doceditor.py @@ -81,6 +81,8 @@ class GuiDocEditor(QTextEdit): # Custom Shortcuts QShortcut(QKeySequence("Ctrl+."), self, context=Qt.WidgetShortcut, activated=self._openSpellContext) + QShortcut(Qt.Key_Return | Qt.ControlModifier, self, context=Qt.WidgetShortcut, activated=self._insertHardBreak) + QShortcut(Qt.Key_Enter | Qt.ControlModifier, self, context=Qt.WidgetShortcut, activated=self._insertHardBreak) # Set Up Word Count Thread and Timer self.wcInterval = self.mainConf.wordCountTimer @@ -323,6 +325,13 @@ class GuiDocEditor(QTextEdit): # Internal Functions ## + def _insertHardBreak(self): + theCursor = self.textCursor() + theCursor.beginEditBlock() + theCursor.insertText(" \n") + theCursor.endEditBlock() + return + def _openSpellContext(self): self._openContextMenu(self.cursorRect().center()) return @@ -388,7 +397,6 @@ class GuiDocEditor(QTextEdit): self.wcTimer.start() if self.mainConf.doReplace and not self.hasSelection: self._docAutoReplace(self.qDocument.findBlock(thePos)) - # logger.verbose("Doc change signal took %.3f µs" % ((time()-self.lastEdit)*1e6)) return def _docAutoReplace(self, theBlock): diff --git a/sample/sampleNovel/data_b/a8a28a246524_main.nwd b/sample/sampleNovel/data_b/a8a28a246524_main.nwd index 55685694..24790377 100644 --- a/sample/sampleNovel/data_b/a8a28a246524_main.nwd +++ b/sample/sampleNovel/data_b/a8a28a246524_main.nwd @@ -14,3 +14,5 @@ With many cheerful facts about the square of the hypotenuse With many cheerful facts about the square of the hypotenuse With many cheerful facts about the square of the hypotepotenuse + + diff --git a/sample/sampleNovel/nwProject.nwx b/sample/sampleNovel/nwProject.nwx index b5ec63b8..1412184e 100644 --- a/sample/sampleNovel/nwProject.nwx +++ b/sample/sampleNovel/nwProject.nwx @@ -1,5 +1,5 @@ - + Sample Project Sample Project @@ -103,7 +103,7 @@ Finished False UNNUMBERED - 628 + 626 101 3 583