Added Ctrl+Enter as a shortcut for hard line break
This commit is contained in:
@@ -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:
|
||||
|
||||
+9
-1
@@ -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):
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<novelWriterXML appVersion="0.3.2" fileVersion="1.0" timeStamp="2019-10-28 21:28:10">
|
||||
<novelWriterXML appVersion="0.3.2" fileVersion="1.0" timeStamp="2019-10-28 21:42:26">
|
||||
<project>
|
||||
<name>Sample Project</name>
|
||||
<title>Sample Project</title>
|
||||
@@ -103,7 +103,7 @@
|
||||
<status>Finished</status>
|
||||
<expanded>False</expanded>
|
||||
<layout>UNNUMBERED</layout>
|
||||
<charCount>628</charCount>
|
||||
<charCount>626</charCount>
|
||||
<wordCount>101</wordCount>
|
||||
<paraCount>3</paraCount>
|
||||
<cursorPos>583</cursorPos>
|
||||
|
||||
Reference in New Issue
Block a user