From 071be418564827e42085e18c39520420f3b9d7ef Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" <> Date: Sun, 27 May 2007 03:34:42 +0000 Subject: Bug 218618: Show line numbers on patch attachments when viewing them in "diff" mode - Patch by Frédéric Buclin r=justdave a=LpSolit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- template/en/default/attachment/diff-file.html.tmpl | 55 ++++++++++++++++++---- 1 file changed, 45 insertions(+), 10 deletions(-) (limited to 'template/en/default/attachment/diff-file.html.tmpl') diff --git a/template/en/default/attachment/diff-file.html.tmpl b/template/en/default/attachment/diff-file.html.tmpl index cd54ab3ca..da38a36cd 100644 --- a/template/en/default/attachment/diff-file.html.tmpl +++ b/template/en/default/attachment/diff-file.html.tmpl @@ -23,8 +23,11 @@ # between the elements. This is necessary because DOM parent-child-sibling # relations can change and screw up the javascript for restoring, collapsing # and expanding. Do not change without testing all three of those. + # Also, the first empty row is required because 'table-layout: fixed' only + # considers the first row to determine column widths. If a colspan is found, + # it then share the width equally among all columns, which we don't want. #%] -
[% collapsed ? '(+)' : '(-)' %] + + [% current_line_old = section.old_start %] + [% current_line_new = section.new_start %] [% FOREACH group = section.groups %] [% IF group.context %] [% FOREACH line = group.context %] - + + + + + + + [% current_line_old = current_line_old + 1 %] + [% current_line_new = current_line_new + 1 %] [% END %] [% END %] [% IF group.plus.size %] [% IF group.minus.size %] [% i = 0 %] + [%# We need to store them in external variables. %] + [% curr_new = current_line_new %] + [% curr_old = current_line_old %] [% WHILE (i < group.plus.size || i < group.minus.size) %] [% currentloop = 0 %] [% WHILE currentloop < 500 && (i < group.plus.size || i < group.minus.size) %] - - - + + + + + [% currentloop = currentloop + 1 %] [% i = i + 1 %] + [% IF i < group.minus.size %] + [% curr_old = curr_old + 1 %] + [% ELSE %] + [% curr_old = "" %] + [% END %] + [% IF i < group.plus.size %] + [% curr_new = curr_new + 1 %] + [% ELSE %] + [% curr_new = "" %] + [% END %] [% END %] [% END %] + [% current_line_old = current_line_old + group.minus.size %] + [% current_line_new = current_line_new + group.plus.size %] [% ELSE %] [% FOREACH line = group.plus %] [% IF file.is_add %] - + + [% ELSE %] - + + [% END %] + [% current_line_new = current_line_new + 1 %] [% END %] [% END %] [% ELSE %] @@ -118,14 +150,17 @@ incremental_restore() [% FOREACH line = group.minus %] [% IF file.is_remove %] - + + [% ELSE %] + - + [% END %] + [% current_line_old = current_line_old + 1 %] [% END %] [% END %] [% END %] -- cgit v1.2.3-24-g4f1b
[% collapsed ? '(+)' : '(-)' %] [% IF lxr_prefix && !file.is_add %] [% file.filename FILTER html %] [% ELSE %] @@ -49,7 +52,7 @@ incremental_restore() [% section_num = 0 %] [% FOREACH section = sections %] [% section_num = section_num + 1 %] -
+
[% IF file.is_add %] @@ -79,38 +82,67 @@ incremental_restore() Link Here 
[% line FILTER html %]
[% line FILTER html %]
[% current_line_old %]
[% line FILTER html %]
[% current_line_new %]
[% line FILTER html %]
[% group.minus.$i FILTER html %]
[% group.plus.$i FILTER html %]
[% curr_old %]
[% group.minus.$i FILTER html %]
[% curr_new %]
[% group.plus.$i FILTER html %]
[% line FILTER html %]
[% current_line_new %]
[% line FILTER html %]
[% current_line_new %]
[% line FILTER html %]
[% line FILTER html %]
[% current_line_old %]
[% line FILTER html %]
[% current_line_old %]
[% line FILTER html %]