diff --git a/kallithea/lib/diffs.py b/kallithea/lib/diffs.py
--- a/kallithea/lib/diffs.py
+++ b/kallithea/lib/diffs.py
@@ -194,7 +194,7 @@ class DiffProcessor(object):
#used for inline highlighter word split
_token_re = re.compile(r'()(>|<|&|\t| |\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 '>'
if groups[3]:
return '\t'
- if groups[4] and m.start(): # skip 1st column with +/-
+ if groups[4]:
return ' '
+ assert False
return self._escape_re.sub(substitute, safe_unicode(string))