Updated autoreplace to handle quotes better, and to not destry undo history when replacing on a selection.
This commit is contained in:
+19
-17
@@ -58,15 +58,19 @@ class Config:
|
||||
self.mainPanePos = [300, 800]
|
||||
|
||||
## Text Editor
|
||||
self.textFixedW = True
|
||||
self.textWidth = 600
|
||||
self.textMargin = [40, 40]
|
||||
self.doReplace = True
|
||||
self.doReplaceQuote = True
|
||||
self.doReplaceDash = True
|
||||
self.doReplaceDots = True
|
||||
self.replaceQuotes = ["“","”"]
|
||||
self.wordCountTimer = 5.0
|
||||
self.textFixedW = True
|
||||
self.textWidth = 600
|
||||
self.textMargin = [40, 40]
|
||||
self.doReplace = True
|
||||
self.doReplaceSQuote = True
|
||||
self.doReplaceDQuote = True
|
||||
self.doReplaceDash = True
|
||||
self.doReplaceDots = True
|
||||
self.wordCountTimer = 5.0
|
||||
|
||||
self.fmtDoubleQuotes = ["“","”"]
|
||||
self.fmtSingleQuotes = ["‘","’"]
|
||||
self.fmtApostrophe = "’"
|
||||
|
||||
# Check if config file exists
|
||||
if path.isfile(path.join(self.confPath,self.confFile)):
|
||||
@@ -119,16 +123,14 @@ class Config:
|
||||
)
|
||||
if confParser.has_option(cnfSec,"autoreplace"):
|
||||
self.doReplace = confParser.getboolean(cnfSec,"autoreplace")
|
||||
if confParser.has_option(cnfSec,"repquotes"):
|
||||
self.doReplaceQuote = confParser.getboolean(cnfSec,"repquotes")
|
||||
if confParser.has_option(cnfSec,"repsquotes"):
|
||||
self.doReplaceSQuote = confParser.getboolean(cnfSec,"repsquotes")
|
||||
if confParser.has_option(cnfSec,"repdquotes"):
|
||||
self.doReplaceDQuote = confParser.getboolean(cnfSec,"repdquotes")
|
||||
if confParser.has_option(cnfSec,"repdash"):
|
||||
self.doReplaceDash = confParser.getboolean(cnfSec,"repdash")
|
||||
if confParser.has_option(cnfSec,"repdots"):
|
||||
self.doReplaceDots = confParser.getboolean(cnfSec,"repdots")
|
||||
if confParser.has_option(cnfSec,"usequotes"):
|
||||
self.replaceQuotes = self.unpackList(
|
||||
confParser.get(cnfSec,"usequotes"), 2, self.replaceQuotes
|
||||
)
|
||||
|
||||
## Path
|
||||
cnfSec = "Path"
|
||||
@@ -165,10 +167,10 @@ class Config:
|
||||
confParser.set(cnfSec,"width", str(self.textWidth))
|
||||
confParser.set(cnfSec,"margins", self.packList(self.textMargin))
|
||||
confParser.set(cnfSec,"autoreplace",str(self.doReplace))
|
||||
confParser.set(cnfSec,"repquotes", str(self.doReplaceQuote))
|
||||
confParser.set(cnfSec,"repsquotes", str(self.doReplaceSQuote))
|
||||
confParser.set(cnfSec,"repdquotes", str(self.doReplaceDQuote))
|
||||
confParser.set(cnfSec,"repdash", str(self.doReplaceDash))
|
||||
confParser.set(cnfSec,"repdots", str(self.doReplaceDots))
|
||||
confParser.set(cnfSec,"usequotes", self.packList(self.replaceQuotes))
|
||||
|
||||
## Path
|
||||
cnfSec = "Path"
|
||||
|
||||
Reference in New Issue
Block a user