diff --git a/nw/core/tohtml.py b/nw/core/tohtml.py index 74c5a676..0c6199c2 100644 --- a/nw/core/tohtml.py +++ b/nw/core/tohtml.py @@ -77,7 +77,7 @@ class ToHtml(Tokenizer): self.doKeywords = True self.doComments = doComments self.doSynopsis = doSynopsis - self.repDict["\t"] = " "*8 + self.repDict["\t"] = r"!!tab!!" # The viewer replaces these self._buildRegEx() return diff --git a/nw/gui/docviewer.py b/nw/gui/docviewer.py index 13707ae9..3c7c9795 100644 --- a/nw/gui/docviewer.py +++ b/nw/gui/docviewer.py @@ -167,6 +167,18 @@ class GuiDocViewer(QTextBrowser): # Make sure the main GUI knows we changed the content self.theParent.viewMeta.refreshReferences(tHandle) + # Loop through the text and put back in the tabs. Tabs are removed by + # the setHtml function, so the ToHtml class puts in a placeholder. + while self.find("!!tab!!"): + theCursor = self.textCursor() + theCursor.insertText("\t") + + # Refresh the tab stops + if self.mainConf.verQtValue >= 51000: + self.setTabStopDistance(self.mainConf.getTabWidth()) + else: + self.setTabStopWidth(self.mainConf.getTabWidth()) + return True def reloadText(self):