From fcb72c00759880e85d4b0e41466fba3c3ea8b7df Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 2 Jul 2019 18:30:42 +0530 Subject: [PATCH] Make the list actions toggles --- src/calibre/gui2/comments_editor.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/calibre/gui2/comments_editor.py b/src/calibre/gui2/comments_editor.py index bfb7868565..44e9741ef0 100644 --- a/src/calibre/gui2/comments_editor.py +++ b/src/calibre/gui2/comments_editor.py @@ -338,8 +338,11 @@ class EditorWidget(QTextEdit, LineEditECM): # {{{ ls = c.currentList() if ls is not None: lf = ls.format() - lf.setStyle(fmt) - ls.setFormat(lf) + if lf.style() == fmt: + c.setBlockFormat(QTextBlockFormat()) + else: + lf.setStyle(fmt) + ls.setFormat(lf) else: ls = c.createList(fmt) @@ -1053,6 +1056,6 @@ if __name__ == '__main__': w.show() w.html = '''

Test Heading

Test blockquote

He hadn't set out to have an affair, - much less a long-term, devoted one.''' + much less a long-term, devoted one.

hello''' app.exec_() # print w.html