mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix undo not working with sort css
This commit is contained in:
parent
d28114bde1
commit
8d38de825e
@ -336,9 +336,16 @@ class TextEdit(PlainTextEdit):
|
|||||||
from calibre.gui2.dialogs.confirm_delete import confirm
|
from calibre.gui2.dialogs.confirm_delete import confirm
|
||||||
if confirm(_('Sorting CSS rules can in rare cases change the effective styles applied to the book.'
|
if confirm(_('Sorting CSS rules can in rare cases change the effective styles applied to the book.'
|
||||||
' Are you sure you want to proceed?'), 'edit-book-confirm-sort-css', parent=self, config_set=tprefs):
|
' Are you sure you want to proceed?'), 'edit-book-confirm-sort-css', parent=self, config_set=tprefs):
|
||||||
|
c = self.textCursor()
|
||||||
|
c.beginEditBlock()
|
||||||
|
c.movePosition(c.Start), c.movePosition(c.End, c.KeepAnchor)
|
||||||
|
text = unicode(c.selectedText()).replace(PARAGRAPH_SEPARATOR, '\n').rstrip('\0')
|
||||||
from calibre.ebooks.oeb.polish.css import sort_sheet
|
from calibre.ebooks.oeb.polish.css import sort_sheet
|
||||||
text = sort_sheet(current_container(), self.toPlainText()).cssText
|
text = sort_sheet(current_container(), text).cssText
|
||||||
self.setPlainText(text)
|
c.insertText(text)
|
||||||
|
c.movePosition(c.Start)
|
||||||
|
c.endEditBlock()
|
||||||
|
self.setTextCursor(c)
|
||||||
|
|
||||||
def find(self, pat, wrap=False, marked=False, complete=False, save_match=None):
|
def find(self, pat, wrap=False, marked=False, complete=False, save_match=None):
|
||||||
if marked:
|
if marked:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user