# HG changeset patch # User Thomas De Schampheleire # Date 1516710685 -3600 # Node ID f79c40759d6f6de3c7858b8871fcfb3c622fdb9d # Parent fcff67b0de83bae7cd09fc8a910b8f977984dd54 lib/diffs: mark trailing tabs similar to trailing spaces So far, spaces have not been marked up, but trailing spaces are followed by '' (newline symbol). Tabs have been marked up as '\t' (underlined with icon), but trailing tabs didn't get the same "trailing whitespace" markup as trailing spaces got. Fix this unfairness by handling trailing tabs explicitly as '\t' so they get both kinds of markup. diff -r fcff67b0de83 -r f79c40759d6f kallithea/lib/diffs.py --- a/kallithea/lib/diffs.py Sun Mar 22 00:14:06 2020 +0100 +++ b/kallithea/lib/diffs.py Tue Jan 23 13:31:25 2018 +0100 @@ -453,7 +453,7 @@ return self.adds, self.removes -_escape_re = re.compile(r'(&)|(<)|(>)|(\t)|(\r)|(?<=.)( \n| $)') +_escape_re = re.compile(r'(&)|(<)|(>)|(\t)|(\r)|(?<=.)( \n| $)|(\t\n|\t$)') def _escaper(string): @@ -470,11 +470,13 @@ if groups[2]: return '>' if groups[3]: - return '\t' + return '\t' # Note: trailing tabs will get a longer match later if groups[4]: return '' if groups[5]: return ' ' + if groups[6]: + return '\t' assert False return _escape_re.sub(substitute, safe_str(string))