From 4981fa187ab2e2268efe7f16fec41f1cda03867c Mon Sep 17 00:00:00 2001 From: zjosua Date: Fri, 25 Jan 2019 23:12:48 +0100 Subject: [PATCH] Reinstate mungeHTML in editor.py The removal of this function in #270 causes
to remain in seemingly empty editor fields, which in turn wrongly prompts the "Close and lose current input?" dialog. --- aqt/editor.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/aqt/editor.py b/aqt/editor.py index d564b2ad5..8a9be8864 100644 --- a/aqt/editor.py +++ b/aqt/editor.py @@ -254,6 +254,7 @@ class Editor: return txt = urllib.parse.unquote(txt) txt = unicodedata.normalize("NFC", txt) + txt = self.mungeHTML(txt) # misbehaving apps may include a null byte in the text txt = txt.replace("\x00", "") # reverse the url quoting we added to get images to display @@ -285,6 +286,10 @@ class Editor: else: print("uncaught cmd", cmd) + def mungeHTML(self, txt): + txt = re.sub(r"
$", "", txt) + return txt + # Setting/unsetting the current note ######################################################################