From c2c85534ea7d810eaccf00ac13c70bdcc417f422 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 7 Jul 2021 21:36:21 +0530 Subject: [PATCH] Fix formatting of tweak docs New para lines should not be appended to the preceding blank line with a space --- src/calibre/gui2/preferences/tweaks.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/calibre/gui2/preferences/tweaks.py b/src/calibre/gui2/preferences/tweaks.py index 6fe1288a7b..94fb6e50e4 100644 --- a/src/calibre/gui2/preferences/tweaks.py +++ b/src/calibre/gui2/preferences/tweaks.py @@ -46,7 +46,10 @@ def format_doc(doc): default_indent = indent current_indent = indent if indent == default_indent: - lines[-1] += ' ' + line + if lines and lines[-1]: + lines[-1] += ' ' + line + else: + lines.append(line) else: lines.append(' ' + line.strip()) return '\n'.join(lines).lstrip()