From da0cbfec32d853669bf7e575118612bbf573197a Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Wed, 20 Apr 2022 17:23:11 +1000 Subject: [PATCH] Add workaround for unwanted CF_HTML header when pasting on Windows Fixes #1751 for now; hopefully we can roll this change back once 6.3.1 is out in 3-4 weeks. --- qt/aqt/editor.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/qt/aqt/editor.py b/qt/aqt/editor.py index 53be64bcb..073696c9a 100644 --- a/qt/aqt/editor.py +++ b/qt/aqt/editor.py @@ -1346,6 +1346,10 @@ class EditorWebView(AnkiWebView): if not mime.hasHtml(): return html = mime.html() + if is_win and qtmajor == 6: + # workaround Qt including CF_HTML header in clipboard + # FIXME: remove after we switch to Qt 6.2.5/6.3.1+. + html = re.sub(r"^Version:0.9(.|\r|\n)+?SourceURL:.*?\r\n", "", html) mime.setHtml(f"{html}") aqt.mw.progress.timer(10, lambda: clip.setMimeData(mime), False, parent=self)