Added the option to show tabs and spaces and line endings.

This commit is contained in:
Veronica K. B. Olsen
2019-10-29 18:38:16 +01:00
parent e2b8ce1f89
commit 9fb28281f3
3 changed files with 82 additions and 44 deletions
+8 -1
View File
@@ -126,7 +126,7 @@ class GuiDocEditor(QTextEdit):
# Reload dictionaries
self.setDictionaries()
# Set Font
# Set font
theFont = QFont()
if self.mainConf.textFont is None:
# If none is defined, set the default back to config
@@ -145,13 +145,20 @@ class GuiDocEditor(QTextEdit):
# Also set the document text options for the document text flow
theOpt = QTextOption()
if self.mainConf.tabWidth is not None:
if self.mainConf.verQtValue >= 51000:
theOpt.setTabStopDistance(self.mainConf.tabWidth)
if self.mainConf.doJustify:
theOpt.setAlignment(Qt.AlignJustify)
if self.mainConf.showTabsNSpaces:
theOpt.setFlags(theOpt.flags() | QTextOption.ShowTabsAndSpaces)
if self.mainConf.showLineEndings:
theOpt.setFlags(theOpt.flags() | QTextOption.ShowLineAndParagraphSeparators)
self.qDocument.setDefaultTextOption(theOpt)
# Initialise the syntax highlighter
self.hLight.initHighlighter()
# If we have a document open, we should reload it in case the font changed