From 40e174d5364910750413d94b5417e57d108190ef Mon Sep 17 00:00:00 2001 From: Ragnar Ouchterlony Date: Sun, 13 Sep 2009 19:36:35 +0200 Subject: First version of side-by-side diff. This constitutes the first prototype of a side-by-side diff. It is not possible to switch between unidiff and side-by-side diff at all at this stage. Signed-off-by: Ragnar Ouchterlony Signed-off-by: Lars Hjemli --- cgit.css | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'cgit.css') diff --git a/cgit.css b/cgit.css index c47ebc9..bf58b8a 100644 --- a/cgit.css +++ b/cgit.css @@ -601,3 +601,38 @@ table.hgraph div.bar { background-color: #eee; height: 1em; } + +table.ssdiff td.add { + color: black; + background: #afa; +} + +table.ssdiff td.add_dark { + color: black; + background: #9c9; +} + +table.ssdiff td.del { + color: black; + background: #faa; +} + +table.ssdiff td.del_dark { + color: black; + background: #c99; +} + +table.ssdiff td.changed { + color: black; + background: #ffa; +} + +table.ssdiff td.changed_dark { + color: black; + background: #cc9; +} + +table.ssdiff td.hunk { + color: #black; + background: #ccf; +} -- cgit v1.2.1 From 207cc34711039329b41345f716bf421a88a6fd0a Mon Sep 17 00:00:00 2001 From: Ragnar Ouchterlony Date: Tue, 15 Sep 2009 19:44:37 +0200 Subject: Polishing of how the side-by-side diff looks. Aligned all different files, so that all side-by-side tables look the same. Also made sure that the tables take up the whole browser width. Also various changes to the css to make things easier on the eye. Signed-off-by: Ragnar Ouchterlony Signed-off-by: Lars Hjemli --- cgit.css | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 60 insertions(+), 6 deletions(-) (limited to 'cgit.css') diff --git a/cgit.css b/cgit.css index bf58b8a..3f37165 100644 --- a/cgit.css +++ b/cgit.css @@ -602,37 +602,91 @@ table.hgraph div.bar { height: 1em; } +table.ssdiff { + width: 100%; +} + +table.ssdiff td { + font-size: 75%; + font-family: monospace; + white-space: pre; + padding: 1px 4px 1px 4px; + border-left: solid 1px #aaa; + border-right: solid 1px #aaa; +} + table.ssdiff td.add { color: black; - background: #afa; + background: #cfc; + min-width: 50%; } table.ssdiff td.add_dark { color: black; - background: #9c9; + background: #aca; + min-width: 50%; } table.ssdiff td.del { color: black; - background: #faa; + background: #fcc; + min-width: 50%; } table.ssdiff td.del_dark { color: black; - background: #c99; + background: #caa; + min-width: 50%; } table.ssdiff td.changed { color: black; - background: #ffa; + background: #ffc; + min-width: 50%; } table.ssdiff td.changed_dark { color: black; - background: #cc9; + background: #cca; + min-width: 50%; +} + +table.ssdiff td.lineno { + color: black; + background: #eee; + text-align: right; + width: 3em; + min-width: 3em; } table.ssdiff td.hunk { color: #black; background: #ccf; + border-top: solid 1px #aaa; + border-bottom: solid 1px #aaa; } + +table.ssdiff td.head { + border-top: solid 1px #aaa; + border-bottom: solid 1px #aaa; +} + +table.ssdiff td.head div.head { + font-weight: bold; + color: black; +} + +table.ssdiff td.foot { + border-top: solid 1px #aaa; + border-left: none; + border-right: none; + border-bottom: none; +} + +table.ssdiff td.space { + border: none; +} + +table.ssdiff td.space div { + min-height: 3em; +} \ No newline at end of file -- cgit v1.2.1 From 735e15e38a484bf0daa98776fa7cde270a271cda Mon Sep 17 00:00:00 2001 From: Ragnar Ouchterlony Date: Sun, 25 Oct 2009 18:13:22 +0100 Subject: In side-by-side diff, add support for marking individual characters. Refuses to do so if the left hand side of the diff has different amount of differing lines to the right hand side to avoid confusion. Note that I use the naive dynamic programming approach for calculating the longest common subsequence. We could probably be more efficient by using a better algorithm. The LCS calculating function is O(n*m) and uses up n*m amount of memory too (so if we we compare two strings of length 100, I use an array of 10000 for calculating the LCS). Might want to not calculate LCS if the length of the line is too large. Signed-off-by: Ragnar Ouchterlony --- cgit.css | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'cgit.css') diff --git a/cgit.css b/cgit.css index 3f37165..9e6d2a4 100644 --- a/cgit.css +++ b/cgit.css @@ -627,6 +627,11 @@ table.ssdiff td.add_dark { min-width: 50%; } +table.ssdiff span.add { + background: #cfc; + font-weight: bold; +} + table.ssdiff td.del { color: black; background: #fcc; @@ -639,6 +644,11 @@ table.ssdiff td.del_dark { min-width: 50%; } +table.ssdiff span.del { + background: #fcc; + font-weight: bold; +} + table.ssdiff td.changed { color: black; background: #ffc; -- cgit v1.2.1