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:
|
if dst == w:
|
||||||
return
|
return
|
||||||
# check if there's alredy something there
|
# check if there's alredy something there
|
||||||
|
oldSrc = src.toHtml()
|
||||||
oldDst = dst.toHtml()
|
oldDst = dst.toHtml()
|
||||||
if unicode(dst.toPlainText()):
|
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])
|
src.setHtml(self.lastCloze[0])
|
||||||
dst.setHtml("")
|
dst.setHtml("")
|
||||||
self.lastCloze = None
|
self.lastCloze = None
|
||||||
|
@ -647,7 +650,8 @@ class FactEditor(object):
|
||||||
oldSrc = unicode(src.toHtml())
|
oldSrc = unicode(src.toHtml())
|
||||||
src.setHtml(new)
|
src.setHtml(new)
|
||||||
dst.setHtml(old)
|
dst.setHtml(old)
|
||||||
self.lastCloze = (oldSrc, unicode(dst.toHtml()))
|
self.lastCloze = (oldSrc, unicode(src.toHtml()),
|
||||||
|
unicode(dst.toHtml()))
|
||||||
self.saveFields()
|
self.saveFields()
|
||||||
|
|
||||||
def onClozeUndo(self):
|
def onClozeUndo(self):
|
||||||
|
|
Loading…
Reference in a new issue