From 7969c583517701236138da1966ec8ef1da48eb97 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Thu, 31 Oct 2019 12:46:52 +0100 Subject: [PATCH] Make sure editor is clear if we're not re-loading a document when we're initialising it --- nw/gui/doceditor.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nw/gui/doceditor.py b/nw/gui/doceditor.py index d7b64290..e8e9bb4e 100644 --- a/nw/gui/doceditor.py +++ b/nw/gui/doceditor.py @@ -161,12 +161,15 @@ class GuiDocEditor(QTextEdit): # Initialise the syntax highlighter self.hLight.initHighlighter() - # If we have a document open, we should reload it in case the font changed + # If we have a document open, we should reload it in case the font changed, otherwise + # we just clear the editor entirely, which makes it read only. if self.theHandle is not None: tHandle = self.theHandle self.clearEditor() self.loadText(tHandle) self.changeWidth() + else: + self.clearEditor() return True