Remove existing space when auto-inserting space (#1131)
This commit is contained in:
@@ -1993,12 +1993,16 @@ class GuiDocEditor(QTextEdit):
|
||||
tInsert = nwUnicode.U_HELLIP
|
||||
|
||||
tCheck = tInsert
|
||||
if tCheck in self.mainConf.fmtPadBefore:
|
||||
if self.mainConf.fmtPadBefore and tCheck in self.mainConf.fmtPadBefore:
|
||||
if self._allowSpaceBeforeColon(theText, tCheck):
|
||||
nDelete = max(nDelete, 1)
|
||||
chkPos = thePos - nDelete - 1
|
||||
if chkPos >= 0 and theText[chkPos].isspace():
|
||||
# Strip existing space before inserting a new (#1061)
|
||||
nDelete += 1
|
||||
tInsert = self._typPadChar + tInsert
|
||||
|
||||
if tCheck in self.mainConf.fmtPadAfter:
|
||||
if self.mainConf.fmtPadAfter and tCheck in self.mainConf.fmtPadAfter:
|
||||
if self._allowSpaceBeforeColon(theText, tCheck):
|
||||
nDelete = max(nDelete, 1)
|
||||
tInsert = tInsert + self._typPadChar
|
||||
|
||||
@@ -35,6 +35,8 @@ Some “ double quoted text with spaces padded ”.
|
||||
|
||||
Add space before this colon : See?
|
||||
|
||||
But don’t add a double space : See?
|
||||
|
||||
“Tab-indented text”
|
||||
|
||||
>“Paragraph-indented text”
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<novelWriterXML appVersion="1.7-beta1" hexVersion="0x010700b1" fileVersion="1.4" timeStamp="2022-09-29 19:57:40">
|
||||
<novelWriterXML appVersion="1.7-beta1" hexVersion="0x010700b1" fileVersion="1.4" timeStamp="2022-10-01 22:33:13">
|
||||
<project>
|
||||
<name>New Project</name>
|
||||
<title>New Novel</title>
|
||||
@@ -17,8 +17,8 @@
|
||||
<lastViewed>None</lastViewed>
|
||||
<lastNovel>0000000000008</lastNovel>
|
||||
<lastOutline>0000000000008</lastOutline>
|
||||
<lastWordCount>145</lastWordCount>
|
||||
<novelWordCount>118</novelWordCount>
|
||||
<lastWordCount>153</lastWordCount>
|
||||
<novelWordCount>126</novelWordCount>
|
||||
<notesWordCount>27</notesWordCount>
|
||||
<autoReplace/>
|
||||
<titleFormat>
|
||||
@@ -59,7 +59,7 @@
|
||||
<name status="s000000" import="i000004" exported="True">New Chapter</name>
|
||||
</item>
|
||||
<item handle="000000000000f" parent="000000000000d" root="0000000000008" order="1" type="FILE" class="NOVEL" layout="DOCUMENT">
|
||||
<meta expanded="False" charCount="693" wordCount="111" paraCount="12" cursorPos="917"/>
|
||||
<meta expanded="False" charCount="728" wordCount="119" paraCount="13" cursorPos="954"/>
|
||||
<name status="s000000" import="i000004" exported="True">New Scene</name>
|
||||
</item>
|
||||
<item handle="0000000000009" parent="None" root="0000000000009" order="1" type="ROOT" class="PLOT">
|
||||
|
||||
@@ -439,6 +439,11 @@ 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)
|
||||
|
||||
for c in "But don't add a double space : 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
|
||||
|
||||
Reference in New Issue
Block a user