mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Remove format should work even with no selection
This commit is contained in:
parent
a737b0e786
commit
356f65cd5b
@ -255,8 +255,7 @@ class EditorWidget(QTextEdit, LineEditECM): # {{{
|
|||||||
self.action_cut.setEnabled(copy_available)
|
self.action_cut.setEnabled(copy_available)
|
||||||
|
|
||||||
def update_selection_based_actions(self):
|
def update_selection_based_actions(self):
|
||||||
has_selection = self.textCursor().hasSelection()
|
pass
|
||||||
self.action_remove_format.setEnabled(has_selection)
|
|
||||||
|
|
||||||
def update_cursor_position_actions(self):
|
def update_cursor_position_actions(self):
|
||||||
c = self.textCursor()
|
c = self.textCursor()
|
||||||
@ -352,9 +351,7 @@ class EditorWidget(QTextEdit, LineEditECM): # {{{
|
|||||||
c = self.textCursor()
|
c = self.textCursor()
|
||||||
c.beginEditBlock()
|
c.beginEditBlock()
|
||||||
c.setBlockFormat(QTextBlockFormat())
|
c.setBlockFormat(QTextBlockFormat())
|
||||||
text = c.selectedText()
|
c.setCharFormat(QTextCharFormat())
|
||||||
c.removeSelectedText()
|
|
||||||
c.insertText(text)
|
|
||||||
c.endEditBlock()
|
c.endEditBlock()
|
||||||
self.setTextCursor(c)
|
self.setTextCursor(c)
|
||||||
self.focus_self()
|
self.focus_self()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user