make sure undo done only if both q and a are the same

This commit is contained in:
Damien Elmes 2009-02-08 04:42:03 +09:00
parent b47ad74d2a
commit 177ab82ed1

View file

@ -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):