From 080118876a68b40d638f780720fb93f84f7c3d22 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Wed, 6 Feb 2019 11:59:55 +1000 Subject: [PATCH] preserve whitespace when pasting text --- aqt/editor.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/aqt/editor.py b/aqt/editor.py index 251322847..e284e4a2c 100644 --- a/aqt/editor.py +++ b/aqt/editor.py @@ -938,7 +938,10 @@ class EditorWebView(AnkiWebView): # normal text; convert it to HTML txt = html.escape(txt) - txt = txt.replace("\n", "
") + txt = txt.replace("\n", "
")\ + .replace("\t", " "*4)\ + .replace(" ", " ") + return txt def _processHtml(self, mime):