From 3f2bc453680853526696bb41dd0aad501cece901 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 15 Apr 2021 09:57:52 +0530 Subject: [PATCH] Metadata comments editor: Fix setting block alignment destroying other block level properties. Fixes #1924187 [Edit metadata: Text alignment on lists in WYSIWYG editor](https://bugs.launchpad.net/calibre/+bug/1924187) --- 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 0325a36826..3c4e70ce16 100644 --- a/src/calibre/gui2/comments_editor.py +++ b/src/calibre/gui2/comments_editor.py @@ -457,7 +457,8 @@ class EditorWidget(QTextEdit, LineEditECM): # {{{ def do_alignment(self, which): with self.editing_cursor() as c: - fmt = QTextBlockFormat() + c = self.textCursor() + fmt = c.blockFormat() fmt.setAlignment(which) c.setBlockFormat(fmt)