diff options
Diffstat (limited to 'lib/AdminPanel/Rpmdragora')
-rw-r--r-- | lib/AdminPanel/Rpmdragora/rpmnew.pm | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/lib/AdminPanel/Rpmdragora/rpmnew.pm b/lib/AdminPanel/Rpmdragora/rpmnew.pm index 97e2b7a..f9b9610 100644 --- a/lib/AdminPanel/Rpmdragora/rpmnew.pm +++ b/lib/AdminPanel/Rpmdragora/rpmnew.pm @@ -134,9 +134,26 @@ sub _performDiff ($$) { my $diff = diff $file, $rpmnew, { STYLE => "Unified" }; $diff = $loc->N("(none)") if !$diff; - ensure_utf8($diff); - $diff =~ s/\n/<br>/g; + my @lines = split ("\n", $diff); + ## adding color lines to diff + foreach my $line (@lines) { + if (substr ($line, 0, 1) eq "+") { + $line =~ s|^\+(.*)|<font color="green">+$1</font>|; + } + elsif (substr ($line, 0, 1) eq "-") { + $line =~ s|^\-(.*)|<font color="red">-$1</font>|; + } + elsif (substr ($line, 0, 1) eq "@") { + $line =~ s|(.*)|<font color="blue">$1</font>|; + } + else { + $line =~ s|(.*)|<font color="black">$1</font>|; + } + } + $diff = join("<br>", @lines); + + ensure_utf8($diff); $diffBox->setValue($diff); return; |