diff --git a/nw/config.py b/nw/config.py index 8e7b6a61..33cae9f1 100644 --- a/nw/config.py +++ b/nw/config.py @@ -126,6 +126,7 @@ class Config: self.bigDocLimit = 800 self.showFullPath = True self.highlightQuotes = True + self.highlightEmph = True self.fmtApostrophe = nwUnicode.U_RSQUO self.fmtSingleQuotes = [nwUnicode.U_LSQUO, nwUnicode.U_RSQUO] @@ -469,6 +470,9 @@ class Config: self.highlightQuotes = self._parseLine( cnfParse, cnfSec, "highlightquotes", self.CNF_BOOL, self.highlightQuotes ) + self.highlightEmph = self._parseLine( + cnfParse, cnfSec, "highlightemph", self.CNF_BOOL, self.highlightEmph + ) ## Backup cnfSec = "Backup" @@ -590,6 +594,7 @@ class Config: cnfParse.set(cnfSec,"bigdoclimit", str(self.bigDocLimit)) cnfParse.set(cnfSec,"showfullpath", str(self.showFullPath)) cnfParse.set(cnfSec,"highlightquotes", str(self.highlightQuotes)) + cnfParse.set(cnfSec,"highlightemph", str(self.highlightEmph)) ## Backup cnfSec = "Backup" diff --git a/nw/gui/dochighlight.py b/nw/gui/dochighlight.py index deb646b2..8f32bfca 100644 --- a/nw/gui/dochighlight.py +++ b/nw/gui/dochighlight.py @@ -82,7 +82,6 @@ class GuiDocHighlighter(QSyntaxHighlighter): self.colHead = QColor(*self.theTheme.colHead) self.colHeadH = QColor(*self.theTheme.colHeadH) - self.colEmph = QColor(*self.theTheme.colEmph) self.colDialN = QColor(*self.theTheme.colDialN) self.colDialD = QColor(*self.theTheme.colDialD) self.colDialS = QColor(*self.theTheme.colDialS) @@ -96,6 +95,11 @@ class GuiDocHighlighter(QSyntaxHighlighter): self.colTrail = QColor(*self.theTheme.colEmph) self.colTrail.setAlpha(64) + if self.mainConf.highlightEmph: + self.colEmph = QColor(*self.theTheme.colEmph) + else: + self.colEmph = None + self.hStyles = { "header1" : self._makeFormat(self.colHead, "bold", 1.8), "header2" : self._makeFormat(self.colHead, "bold", 1.6), diff --git a/nw/gui/preferences.py b/nw/gui/preferences.py index 3abedfc2..16e63dce 100644 --- a/nw/gui/preferences.py +++ b/nw/gui/preferences.py @@ -629,7 +629,16 @@ class GuiConfigEditEditingTab(QWidget): self.highlightQuotes.setChecked(self.mainConf.highlightQuotes) self.mainForm.addRow( "Highlight text wrapped in quotes", - self.highlightQuotes + self.highlightQuotes, + helpText="Applies to single, double and straight quotes." + ) + + self.highlightEmph = QSwitch() + self.highlightEmph.setChecked(self.mainConf.highlightEmph) + self.mainForm.addRow( + "Add highlight colour to emphasised text", + self.highlightEmph, + helpText="Applies to emphasis, strong and strikethrough." ) # Spell Checking @@ -687,12 +696,14 @@ class GuiConfigEditEditingTab(QWidget): guiSyntax = self.selectSyntax.currentData() highlightQuotes = self.highlightQuotes.isChecked() + highlightEmph = self.highlightEmph.isChecked() spellTool = self.spellToolList.currentData() spellLanguage = self.spellLangList.currentData() bigDocLimit = self.bigDocLimit.value() self.mainConf.guiSyntax = guiSyntax self.mainConf.highlightQuotes = highlightQuotes + self.mainConf.highlightEmph = highlightEmph self.mainConf.spellTool = spellTool self.mainConf.spellLanguage = spellLanguage self.mainConf.bigDocLimit = bigDocLimit