Mercurial > kallithea
changeset 8708:3fb80ff77bda
diffs: simplify trick to avoid "trailing space" markup of empty diff lines
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Wed, 28 Oct 2020 14:51:26 +0100 |
parents | 161cf7e3566f |
children | 53142fd5af4e |
files | kallithea/lib/diffs.py |
diffstat | 1 files changed, 3 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/kallithea/lib/diffs.py Wed Oct 28 14:08:28 2020 +0100 +++ b/kallithea/lib/diffs.py Wed Oct 28 14:51:26 2020 +0100 @@ -445,7 +445,7 @@ return self.adds, self.removes -_escape_re = re.compile(r'(&)|(<)|(>)|(\t)|(\r)|(?<=.)( $)|(\t$)') +_escape_re = re.compile(r'(&)|(<)|(>)|(\t)|(\r)|( $)|(\t$)') def _escaper(diff_line): @@ -503,6 +503,8 @@ if groups[4]: return '<u class="cr"></u>' if groups[5]: + if m.start() == 0: + return ' ' # first column space shouldn't make empty lines show up as trailing space return ' <i></i>' if groups[6]: return '<u>\t</u><i></i>'