diff --git a/nw/gui/build.py b/nw/gui/build.py index 0370e23c..b61dfd0f 100644 --- a/nw/gui/build.py +++ b/nw/gui/build.py @@ -1037,10 +1037,9 @@ class GuiBuildNovelDocView(QTextBrowser): self.verticalScrollBar().setValue(sPos) self._updateBuildAge() - # This forces a repaint of the text, It's a hack to fix an occational - # issue where the find/replace above interfers with the rendering and - # leaves parts of the document blank. - self.qDocument.setTextWidth(self.qDocument.textWidth()) + # Since we change the content while it may still be rendering, we mark + # the document dirty again to make sure it's re-rendered properly. + self.qDocument.markContentsDirty(0, self.qDocument.characterCount()) return diff --git a/nw/gui/docviewer.py b/nw/gui/docviewer.py index 63a41e9b..b613ac2f 100644 --- a/nw/gui/docviewer.py +++ b/nw/gui/docviewer.py @@ -180,10 +180,9 @@ class GuiDocViewer(QTextBrowser): # Make sure the main GUI knows we changed the content self.theParent.viewMeta.refreshReferences(tHandle) - # This forces a repaint of the text, It's a hack to fix an occational - # issue where the find/replace above interfers with the rendering and - # leaves parts of the document blank. - self.qDocument.setTextWidth(self.qDocument.textWidth()) + # Since we change the content while it may still be rendering, we mark + # the document dirty again to make sure it's re-rendered properly. + self.qDocument.markContentsDirty(0, self.qDocument.characterCount()) return True