Tweak the editor auto-replace logic to allow markup for dialogue (#2488)
This commit is contained in:
@@ -2335,33 +2335,47 @@ class TextAutoReplace:
|
|||||||
t4 = text[-4:]
|
t4 = text[-4:]
|
||||||
|
|
||||||
leading = t2[:1].isspace()
|
leading = t2[:1].isspace()
|
||||||
if self._replaceDQuote:
|
if self._replaceDQuote and t1 == '"':
|
||||||
if leading and t2.endswith('"'):
|
if pos == 1:
|
||||||
return 1, self._quoteDO
|
return 1, self._quoteDO
|
||||||
elif t1 == '"':
|
elif leading and t2.endswith('"'):
|
||||||
if pos == 1:
|
return 1, self._quoteDO
|
||||||
return 1, self._quoteDO
|
elif pos == 2 and t2 == '>"':
|
||||||
elif pos == 2 and t2 == '>"':
|
return 1, self._quoteDO
|
||||||
return 1, self._quoteDO
|
elif pos == 3 and t3 == '>>"':
|
||||||
elif pos == 3 and t3 == '>>"':
|
return 1, self._quoteDO
|
||||||
return 1, self._quoteDO
|
elif pos == 2 and t2 == '_"':
|
||||||
else:
|
return 1, self._quoteDO
|
||||||
return 1, self._quoteDC
|
elif t3 == ' _"':
|
||||||
|
return 1, self._quoteDO
|
||||||
|
elif pos == 3 and t3 in ('**"', '=="', '~~"'):
|
||||||
|
return 1, self._quoteDO
|
||||||
|
elif t4 in (' **"', ' =="', ' ~~"'):
|
||||||
|
return 1, self._quoteDO
|
||||||
|
else:
|
||||||
|
return 1, self._quoteDC
|
||||||
|
|
||||||
if self._replaceSQuote:
|
if self._replaceSQuote and t1 == "'":
|
||||||
if leading and t2.endswith("'"):
|
if pos == 1:
|
||||||
return 1, self._quoteSO
|
return 1, self._quoteSO
|
||||||
elif t1 == "'":
|
elif leading and t2.endswith("'"):
|
||||||
if pos == 1:
|
return 1, self._quoteSO
|
||||||
return 1, self._quoteSO
|
elif pos == 2 and t2 == ">'":
|
||||||
elif pos == 2 and t2 == ">'":
|
return 1, self._quoteSO
|
||||||
return 1, self._quoteSO
|
elif pos == 3 and t3 == ">>'":
|
||||||
elif pos == 3 and t3 == ">>'":
|
return 1, self._quoteSO
|
||||||
return 1, self._quoteSO
|
elif pos == 2 and t2 == "_'":
|
||||||
else:
|
return 1, self._quoteDO
|
||||||
return 1, self._quoteSC
|
elif t3 == " _'":
|
||||||
|
return 1, self._quoteDO
|
||||||
|
elif pos == 3 and t3 in ("**'", "=='", "~~'"):
|
||||||
|
return 1, self._quoteDO
|
||||||
|
elif t4 in (" **'", " =='", " ~~'"):
|
||||||
|
return 1, self._quoteDO
|
||||||
|
else:
|
||||||
|
return 1, self._quoteSC
|
||||||
|
|
||||||
if self._replaceDash:
|
if self._replaceDash and t1 == "-":
|
||||||
if t4 == "----":
|
if t4 == "----":
|
||||||
return 4, "\u2015" # Horizontal bar
|
return 4, "\u2015" # Horizontal bar
|
||||||
elif t3 == "---":
|
elif t3 == "---":
|
||||||
|
|||||||
Reference in New Issue
Block a user