Fix smart quote issue (#874)
This commit is contained in:
+10
-2
@@ -1763,7 +1763,7 @@ class GuiDocEditor(QTextEdit):
|
||||
nDelete = 0
|
||||
tInsert = theOne
|
||||
|
||||
if self.mainConf.doReplaceDQuote and theTwo == ' "':
|
||||
if self.mainConf.doReplaceDQuote and theTwo[:1].isspace() and theTwo.endswith('"'):
|
||||
nDelete = 1
|
||||
tInsert = self._typDQOpen
|
||||
|
||||
@@ -1771,10 +1771,14 @@ class GuiDocEditor(QTextEdit):
|
||||
nDelete = 1
|
||||
if thePos == 1:
|
||||
tInsert = self._typDQOpen
|
||||
elif thePos == 2 and theTwo == '>"':
|
||||
tInsert = self._typDQOpen
|
||||
elif thePos == 3 and theThree == '>>"':
|
||||
tInsert = self._typDQOpen
|
||||
else:
|
||||
tInsert = self._typDQClose
|
||||
|
||||
elif self.mainConf.doReplaceSQuote and theTwo == " '":
|
||||
elif self.mainConf.doReplaceSQuote and theTwo[:1].isspace() and theTwo.endswith("'"):
|
||||
nDelete = 1
|
||||
tInsert = self._typSQOpen
|
||||
|
||||
@@ -1782,6 +1786,10 @@ class GuiDocEditor(QTextEdit):
|
||||
nDelete = 1
|
||||
if thePos == 1:
|
||||
tInsert = self._typSQOpen
|
||||
elif thePos == 2 and theTwo == ">'":
|
||||
tInsert = self._typSQOpen
|
||||
elif thePos == 3 and theThree == ">>'":
|
||||
tInsert = self._typSQOpen
|
||||
else:
|
||||
tInsert = self._typSQClose
|
||||
|
||||
|
||||
@@ -27,3 +27,15 @@ This is another paragraph of much longer nonsense text. It is in fact 1 very ver
|
||||
|
||||
‘Full line single quoted text.’
|
||||
|
||||
“Tab-indented text”
|
||||
|
||||
>“Paragraph-indented text”
|
||||
|
||||
>>“Right-aligned text”
|
||||
|
||||
‘Tab-indented text’
|
||||
|
||||
>‘Paragraph-indented text’
|
||||
|
||||
>>‘Right-aligned text’
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<novelWriterXML appVersion="1.2a0" hexVersion="0x010200a0" fileVersion="1.2" timeStamp="2021-01-29 01:10:23">
|
||||
<novelWriterXML appVersion="1.4.1" hexVersion="0x010401f0" fileVersion="1.2" timeStamp="2021-08-30 23:21:21">
|
||||
<project>
|
||||
<name>New Project</name>
|
||||
<title></title>
|
||||
<saveCount>4</saveCount>
|
||||
<saveCount>5</saveCount>
|
||||
<autoCount>2</autoCount>
|
||||
<editTime>8</editTime>
|
||||
<editTime>5</editTime>
|
||||
</project>
|
||||
<settings>
|
||||
<doBackup>True</doBackup>
|
||||
@@ -15,8 +15,8 @@
|
||||
<autoOutline>True</autoOutline>
|
||||
<lastEdited>0e17daca5f3e1</lastEdited>
|
||||
<lastViewed>None</lastViewed>
|
||||
<lastWordCount>114</lastWordCount>
|
||||
<novelWordCount>87</novelWordCount>
|
||||
<lastWordCount>126</lastWordCount>
|
||||
<novelWordCount>99</novelWordCount>
|
||||
<notesWordCount>27</notesWordCount>
|
||||
<autoReplace/>
|
||||
<titleFormat>
|
||||
@@ -85,10 +85,10 @@
|
||||
<status>New</status>
|
||||
<exported>True</exported>
|
||||
<layout>BOOK</layout>
|
||||
<charCount>482</charCount>
|
||||
<wordCount>83</wordCount>
|
||||
<paraCount>4</paraCount>
|
||||
<cursorPos>620</cursorPos>
|
||||
<charCount>612</charCount>
|
||||
<wordCount>95</wordCount>
|
||||
<paraCount>10</paraCount>
|
||||
<cursorPos>768</cursorPos>
|
||||
</item>
|
||||
<item handle="44cb730c42048" order="1" parent="None">
|
||||
<name>Plot</name>
|
||||
|
||||
@@ -286,6 +286,36 @@ def testGuiMain_Editing(qtbot, monkeypatch, nwGUI, fncProj, refDir, outDir):
|
||||
qtbot.keyClick(nwGUI.docEditor, Qt.Key_Return, delay=keyDelay)
|
||||
qtbot.keyClick(nwGUI.docEditor, Qt.Key_Return, delay=keyDelay)
|
||||
|
||||
for c in "\t\"Tab-indented text\"":
|
||||
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 ">\"Paragraph-indented text\"":
|
||||
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 ">>\"Right-aligned text\"":
|
||||
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 "\t'Tab-indented text'":
|
||||
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 ">'Paragraph-indented text'":
|
||||
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 ">>'Right-aligned text'":
|
||||
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)
|
||||
|
||||
qtbot.wait(stepDelay)
|
||||
nwGUI.docEditor.wCounter.run()
|
||||
qtbot.wait(stepDelay)
|
||||
|
||||
Reference in New Issue
Block a user