From 356f65cd5b4c4bbf559bbeb82e00482a7a0a8ceb Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 2 Jul 2019 14:07:46 +0530 Subject: [PATCH] Remove format should work even with no selection --- src/calibre/gui2/comments_editor.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/calibre/gui2/comments_editor.py b/src/calibre/gui2/comments_editor.py index 7fb65a7b8c..e9f19ab0e7 100644 --- a/src/calibre/gui2/comments_editor.py +++ b/src/calibre/gui2/comments_editor.py @@ -255,8 +255,7 @@ class EditorWidget(QTextEdit, LineEditECM): # {{{ self.action_cut.setEnabled(copy_available) def update_selection_based_actions(self): - has_selection = self.textCursor().hasSelection() - self.action_remove_format.setEnabled(has_selection) + pass def update_cursor_position_actions(self): c = self.textCursor() @@ -352,9 +351,7 @@ class EditorWidget(QTextEdit, LineEditECM): # {{{ c = self.textCursor() c.beginEditBlock() c.setBlockFormat(QTextBlockFormat()) - text = c.selectedText() - c.removeSelectedText() - c.insertText(text) + c.setCharFormat(QTextCharFormat()) c.endEditBlock() self.setTextCursor(c) self.focus_self()