diff --git a/kallithea/lib/diffs.py b/kallithea/lib/diffs.py --- a/kallithea/lib/diffs.py +++ b/kallithea/lib/diffs.py @@ -642,6 +642,7 @@ class DiffProcessor(object): def as_html(self, table_class='code-difftable', line_class='line', old_lineno_class='lineno old', new_lineno_class='lineno new', + no_lineno_class='lineno', code_class='code', enable_comments=False, parsed_lines=None): """ Return given diff as html table with customized css classes @@ -693,6 +694,8 @@ class DiffProcessor(object): change['old_lineno']) cond_new = (change['new_lineno'] != '...' and change['new_lineno']) + no_lineno = (change['old_lineno'] == '...' and + change['new_lineno'] == '...') if cond_old: anchor_old_id = 'id="%s"' % anchor_old if cond_new: @@ -700,9 +703,10 @@ class DiffProcessor(object): ########################################################### # OLD LINE NUMBER ########################################################### - _html.append('''\t''' % { + _html.append('''\t''' % { 'a_id': anchor_old_id, - 'olc': old_lineno_class + 'olc': no_lineno_class if no_lineno else old_lineno_class, + 'colspan': 'colspan="2"' if no_lineno else '' }) _html.append('''%(link)s''' % { @@ -714,16 +718,17 @@ class DiffProcessor(object): # NEW LINE NUMBER ########################################################### - _html.append('''\t''' % { - 'a_id': anchor_new_id, - 'nlc': new_lineno_class - }) + if not no_lineno: + _html.append('''\t''' % { + 'a_id': anchor_new_id, + 'nlc': new_lineno_class + }) - _html.append('''%(link)s''' % { - 'link': _link_to_if(True, change['new_lineno'], - '#%s' % anchor_new) - }) - _html.append('''\n''') + _html.append('''%(link)s''' % { + 'link': _link_to_if(True, change['new_lineno'], + '#%s' % anchor_new) + }) + _html.append('''\n''') ########################################################### # CODE ########################################################### diff --git a/kallithea/public/css/style.css b/kallithea/public/css/style.css --- a/kallithea/public/css/style.css +++ b/kallithea/public/css/style.css @@ -4901,7 +4901,6 @@ table.code-difftable td.code pre i { table.code-difftable .lineno { padding-left: 2px; padding-right: 2px !important; - text-align: right; width: 30px; -moz-user-select: none; -webkit-user-select: none; @@ -4910,20 +4909,24 @@ table.code-difftable .lineno { border-top: 0px solid #CCC !important; border-bottom: none !important; vertical-align: middle !important; + text-align: center; } table.code-difftable .lineno.new { + text-align: right; } table.code-difftable .lineno.old { + text-align: right; } table.code-difftable .lineno a { color: #aaa !important; font: 11px Consolas, Monaco, Inconsolata, Liberation Mono, monospace !important; letter-spacing: -1px; - text-align: right; + padding-left: 10px; padding-right: 8px; + box-sizing: border-box; cursor: pointer; display: block; - width: 30px; + width: 100%; } table.code-difftable .lineno-inline {