Changeset - 960248c6e021
[Not reviewed]
default
0 1 0
Mads Kiilerich - 11 years ago 2014-12-15 13:47:36
madski@unity3d.com
diff: preserve leading space on empty lines - don't match in re if we don't plan to replace

Fix invisible bug from 7c094db329b3, exposed by future exact parsing of diffs.
1 file changed with 3 insertions and 2 deletions:
0 comments (0 inline, 0 general)
kallithea/lib/diffs.py
Show inline comments
 
@@ -194,7 +194,7 @@ class DiffProcessor(object):
 
    #used for inline highlighter word split
 
    _token_re = re.compile(r'()(&gt;|&lt;|&amp;|<u>\t</u>| <i></i>|\W+?)')
 

	
 
    _escape_re = re.compile(r'(&)|(<)|(>)|(\t)|( \n| $)')
 
    _escape_re = re.compile(r'(&)|(<)|(>)|(\t)|(?<=.)( \n| $)')
 

	
 

	
 
    def __init__(self, diff, vcs='hg', format='gitdiff', diff_limit=None):
 
@@ -261,8 +261,9 @@ class DiffProcessor(object):
 
                return '&gt;'
 
            if groups[3]:
 
                return '<u>\t</u>'
 
            if groups[4] and m.start(): # skip 1st column with +/-
 
            if groups[4]:
 
                return ' <i></i>'
 
            assert False
 

	
 
        return self._escape_re.sub(substitute, safe_unicode(string))
 

	
0 comments (0 inline, 0 general)