Changeset - f79c40759d6f
[Not reviewed]
default
0 1 0
Thomas De Schampheleire - 8 years ago 2018-01-23 13:31:25
thomas.de_schampheleire@nokia.com
Grafted from: d373022dff29
lib/diffs: mark trailing tabs similar to trailing spaces

So far, spaces have not been marked up, but trailing spaces are followed by
'<i></i>' (newline symbol). Tabs have been marked up as '<u>\t</u>' (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 '<u>\t</u><i></i>'
so they get both kinds of markup.
1 file changed with 4 insertions and 2 deletions:
0 comments (0 inline, 0 general)
kallithea/lib/diffs.py
Show inline comments
 
@@ -450,13 +450,13 @@ class DiffProcessor(object):
 
        """
 
        Returns tuple of added, and removed lines for this instance
 
        """
 
        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):
 
    """
 
    Do HTML escaping/markup
 
    """
 
@@ -467,17 +467,19 @@ def _escaper(string):
 
            return '&amp;'
 
        if groups[1]:
 
            return '&lt;'
 
        if groups[2]:
 
            return '&gt;'
 
        if groups[3]:
 
            return '<u>\t</u>'
 
            return '<u>\t</u>'  # Note: trailing tabs will get a longer match later
 
        if groups[4]:
 
            return '<u class="cr"></u>'
 
        if groups[5]:
 
            return ' <i></i>'
 
        if groups[6]:
 
            return '<u>\t</u><i></i>'
 
        assert False
 

	
 
    return _escape_re.sub(substitute, safe_str(string))
 

	
 

	
 
_git_header_re = re.compile(br"""
0 comments (0 inline, 0 general)