mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
make sure undo done only if both q and a are the same
This commit is contained in:
parent
b47ad74d2a
commit
177ab82ed1
1 changed files with 6 additions and 2 deletions
|
@ -616,9 +616,12 @@ class FactEditor(object):
|
|||
if dst == w:
|
||||
return
|
||||
# check if there's alredy something there
|
||||
oldSrc = src.toHtml()
|
||||
oldDst = dst.toHtml()
|
||||
if unicode(dst.toPlainText()):
|
||||
if self.lastCloze and self.lastCloze[1] == oldDst:
|
||||
if (self.lastCloze and
|
||||
self.lastCloze[1] == oldSrc and
|
||||
self.lastCloze[2] == oldDst):
|
||||
src.setHtml(self.lastCloze[0])
|
||||
dst.setHtml("")
|
||||
self.lastCloze = None
|
||||
|
@ -647,7 +650,8 @@ class FactEditor(object):
|
|||
oldSrc = unicode(src.toHtml())
|
||||
src.setHtml(new)
|
||||
dst.setHtml(old)
|
||||
self.lastCloze = (oldSrc, unicode(dst.toHtml()))
|
||||
self.lastCloze = (oldSrc, unicode(src.toHtml()),
|
||||
unicode(dst.toHtml()))
|
||||
self.saveFields()
|
||||
|
||||
def onClozeUndo(self):
|
||||
|
|
Loading…
Reference in a new issue