From d70363d40810d7fa2d5177f1994c2e26c7edfb50 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 16 Jan 2020 09:56:35 +0530 Subject: [PATCH] Comments editor: Fix inserted blank paragraph being rendered as two lines. Qt uses an awful hack of inserting style="-qt-paragraph-type:empty" for blank paragraphs. Preserve this, so that blank paragraphs survive round tripping as HTML, at the cost of uglier markup. --- src/calibre/gui2/comments_editor.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/calibre/gui2/comments_editor.py b/src/calibre/gui2/comments_editor.py index 1bd3d3137e..a7202dae90 100644 --- a/src/calibre/gui2/comments_editor.py +++ b/src/calibre/gui2/comments_editor.py @@ -77,7 +77,8 @@ def lift_styles(tag, style_map): def filter_qt_styles(style): for k in tuple(style): - if k.startswith('-qt-'): + # -qt-paragraph-type is a hack used by Qt for empty paragraphs + if k.startswith('-qt-') and k != '-qt-paragraph-type': del style[k]