Mercurial > kallithea
changeset 4690:960248c6e021
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.
author | Mads Kiilerich <madski@unity3d.com> |
---|---|
date | Mon, 15 Dec 2014 13:47:36 +0100 |
parents | ed4a3c0fe61a |
children | 42d18c125aa8 |
files | kallithea/lib/diffs.py |
diffstat | 1 files changed, 3 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/kallithea/lib/diffs.py Mon Dec 15 13:47:36 2014 +0100 +++ b/kallithea/lib/diffs.py Mon Dec 15 13:47:36 2014 +0100 @@ -194,7 +194,7 @@ #used for inline highlighter word split _token_re = re.compile(r'()(>|<|&|<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 @@ return '>' 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))