diff --git a/gen/mixins/__init__.py b/gen/mixins/__init__.py index e24d791..f70b7c0 100644 --- a/gen/mixins/__init__.py +++ b/gen/mixins/__init__.py @@ -1041,7 +1041,8 @@ class BaseMixin: else: for event in history: if (event['action'] == '_datachange_') and \ - (fieldName in event['changes']): return True + (fieldName in event['changes']) and \ + event['changes'][fieldName][0]: return True def getHistory(self, startNumber=0, reverse=True, includeInvisible=False, batchSize=5): @@ -1079,7 +1080,7 @@ class BaseMixin: (field.format == gen.String.XHTML): # For rich text fields, instead of simply showing the # previous value, we propose a diff with the next - # version. + # version, excepted if the previous value is empty. if field.isEmptyValue(oldValue[0]): val = '-' else: diff --git a/shared/diff.py b/shared/diff.py index e2b0aa0..5654571 100644 --- a/shared/diff.py +++ b/shared/diff.py @@ -660,6 +660,14 @@ class HtmlDiff: def get(self): '''Produces the result.''' + # Normally, if self.old is empty, the whole self.new should be + # considered as inserted text. But see this line: if not self.old or not self.old.strip(): return self.new + # Why? This is for avoiding problems in the case of cumulative diffs. + # A cumulative diff means: calling HtmlDiff with, as old value, the + # result of a previous call to HtmlDiff. In this case, if the whole text + # is already considered as inserted, we will already have overlaps in + # the next diff. Overlaps are hard to manage, so we avoid to get them + # as a starting point when computing cumulative diffs. return self.getHtmlDiff(self.old, self.new, '\n') # ------------------------------------------------------------------------------