From 970fac5e24966d7e296cd044de6a6d0ba585c8c5 Mon Sep 17 00:00:00 2001 From: Jakub Narebski Date: Mon, 31 Oct 2011 00:36:23 +0100 Subject: gitweb: Give side-by-side diff extra CSS styling Use separate background colors for pure removal, pure addition and change for side-by-side diff. This makes reading such diff easier, allowing to easily distinguish empty lines in diff from vertical whitespace used to align chunk blocks. Note that if lines in diff were numbered, the absence of line numbers [for one side] would help in distinguishing empty lines from vertical align. Signed-off-by: Jakub Narebski Signed-off-by: Junio C Hamano --- gitweb/gitweb.perl | 39 +++++++++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 10 deletions(-) (limited to 'gitweb/gitweb.perl') diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl index 68629f66c9..f69ed08310 100755 --- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl @@ -4890,7 +4890,7 @@ sub print_sidebyside_diff_chunk { # empty contents block on start rem/add block, or end of chunk if (@ctx && (!$class || $class eq 'rem' || $class eq 'add')) { print join '', - '
', + '
', '
', @ctx, '
', @@ -4902,15 +4902,34 @@ sub print_sidebyside_diff_chunk { } # empty add/rem block on start context block, or end of chunk if ((@rem || @add) && (!$class || $class eq 'ctx')) { - print join '', - '
', - '
', - @rem, - '
', - '
', - @add, - '
', - '
'; + if (!@add) { + # pure removal + print join '', + '
', + '
', + @rem, + '
', + '
'; + } elsif (!@rem) { + # pure addition + print join '', + '
', + '
', + @add, + '
', + '
'; + } else { + # assume that it is change + print join '', + '
', + '
', + @rem, + '
', + '
', + @add, + '
', + '
'; + } @rem = @add = (); } -- cgit v1.3