# HG changeset patch # User Marcin Kuzminski # Date 1355184930 -3600 # Node ID 7d0476e1f1dc5fdd9e4f2a3c3b7b0741fdd5d084 # Parent 2ec4a2a5316777948cafd12f0f4127cbf89438f9 fixes issue #678 Incorrect diff markup when diff contains >, <, or & symbols - regex by \W did split & and other to 3 tokens, and escaping was broken diff -r 2ec4a2a53167 -r 7d0476e1f1dc rhodecode/lib/diffs.py --- a/rhodecode/lib/diffs.py Tue Dec 11 00:02:23 2012 +0100 +++ b/rhodecode/lib/diffs.py Tue Dec 11 01:15:30 2012 +0100 @@ -193,6 +193,9 @@ (?:^\+\+\+[ ](b/(?P.+)|/dev/null)(?:\n|$))? """, re.VERBOSE | re.MULTILINE) + #used for inline highlighter word split + _token_re = re.compile(r'()(>|<|&|\W+?)') + def __init__(self, diff, vcs='hg', format='gitdiff', diff_limit=None): """ :param diff: a text in diff format @@ -274,9 +277,8 @@ else: old, new = next_, line - oldwords = re.split(r'(\W)', old['line']) - newwords = re.split(r'(\W)', new['line']) - + oldwords = self._token_re.split(old['line']) + newwords = self._token_re.split(new['line']) sequence = difflib.SequenceMatcher(None, oldwords, newwords) oldfragments, newfragments = [], []