Generalise space character detection in quote auto-replace
This commit is contained in:
@@ -2334,11 +2334,11 @@ class TextAutoReplace:
|
||||
t3 = text[-3:]
|
||||
t4 = text[-4:]
|
||||
|
||||
leading = t2[:1].isspace()
|
||||
if self._replaceDQuote and t1 == '"':
|
||||
# Process Double Quote
|
||||
if pos == 1:
|
||||
return 1, self._quoteDO
|
||||
elif leading and t2.endswith('"'):
|
||||
elif t2[:1].isspace() and t2.endswith('"'):
|
||||
return 1, self._quoteDO
|
||||
elif pos == 2 and t2 == '>"':
|
||||
return 1, self._quoteDO
|
||||
@@ -2346,19 +2346,20 @@ class TextAutoReplace:
|
||||
return 1, self._quoteDO
|
||||
elif pos == 2 and t2 == '_"':
|
||||
return 1, self._quoteDO
|
||||
elif t3 == ' _"':
|
||||
elif t3[:1].isspace() and t3.endswith('_"'):
|
||||
return 1, self._quoteDO
|
||||
elif pos == 3 and t3 in ('**"', '=="', '~~"'):
|
||||
return 1, self._quoteDO
|
||||
elif t4 in (' **"', ' =="', ' ~~"'):
|
||||
elif t4[:1].isspace() and t4.endswith(('**"', '=="', '~~"')):
|
||||
return 1, self._quoteDO
|
||||
else:
|
||||
return 1, self._quoteDC
|
||||
|
||||
if self._replaceSQuote and t1 == "'":
|
||||
# Process Single Quote
|
||||
if pos == 1:
|
||||
return 1, self._quoteSO
|
||||
elif leading and t2.endswith("'"):
|
||||
elif t2[:1].isspace() and t2.endswith("'"):
|
||||
return 1, self._quoteSO
|
||||
elif pos == 2 and t2 == ">'":
|
||||
return 1, self._quoteSO
|
||||
@@ -2366,16 +2367,17 @@ class TextAutoReplace:
|
||||
return 1, self._quoteSO
|
||||
elif pos == 2 and t2 == "_'":
|
||||
return 1, self._quoteSO
|
||||
elif t3 == " _'":
|
||||
elif t3[:1].isspace() and t3.endswith("_'"):
|
||||
return 1, self._quoteSO
|
||||
elif pos == 3 and t3 in ("**'", "=='", "~~'"):
|
||||
return 1, self._quoteSO
|
||||
elif t4 in (" **'", " =='", " ~~'"):
|
||||
elif t4[:1].isspace() and t4.endswith(("**'", "=='", "~~'")):
|
||||
return 1, self._quoteSO
|
||||
else:
|
||||
return 1, self._quoteSC
|
||||
|
||||
if self._replaceDash and t1 == "-":
|
||||
# Process Dashes
|
||||
if t4 == "----":
|
||||
return 4, "\u2015" # Horizontal bar
|
||||
elif t3 == "---":
|
||||
@@ -2388,6 +2390,7 @@ class TextAutoReplace:
|
||||
return 2, "\u2015" # Horizontal bar
|
||||
|
||||
if self._replaceDots and t3 == "...":
|
||||
# Process Dots
|
||||
return 3, "\u2026" # Ellipsis
|
||||
|
||||
if t1 == "\u2028": # Line separator
|
||||
|
||||
Reference in New Issue
Block a user