author | Ragnar Ouchterlony <ragnar@lysator.liu.se> | 2009-10-25 17:13:22 (UTC) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2009-11-07 14:37:11 (UTC) |
commit | 735e15e38a484bf0daa98776fa7cde270a271cda (patch) (unidiff) | |
tree | 588545cead471e8997adc1ae5abca164a4873481 /cgit.css | |
parent | 4a198e4b8ee62a9a8b5156a46bfce46dc7223fe9 (diff) | |
download | cgit-735e15e38a484bf0daa98776fa7cde270a271cda.zip cgit-735e15e38a484bf0daa98776fa7cde270a271cda.tar.gz cgit-735e15e38a484bf0daa98776fa7cde270a271cda.tar.bz2 |
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 <ragnar@lysator.liu.se>
-rw-r--r-- | cgit.css | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -582,108 +582,118 @@ table.vgraph div.bar { | |||
582 | 582 | ||
583 | table.hgraph { | 583 | table.hgraph { |
584 | border: solid 1px black; | 584 | border: solid 1px black; |
585 | width: 800px; | 585 | width: 800px; |
586 | } | 586 | } |
587 | 587 | ||
588 | table.hgraph th { | 588 | table.hgraph th { |
589 | background-color: #eee; | 589 | background-color: #eee; |
590 | font-weight: bold; | 590 | font-weight: bold; |
591 | border: solid 1px black; | 591 | border: solid 1px black; |
592 | padding: 1px 0.5em; | 592 | padding: 1px 0.5em; |
593 | } | 593 | } |
594 | 594 | ||
595 | table.hgraph td { | 595 | table.hgraph td { |
596 | vertical-align: center; | 596 | vertical-align: center; |
597 | padding: 2px 2px; | 597 | padding: 2px 2px; |
598 | } | 598 | } |
599 | 599 | ||
600 | table.hgraph div.bar { | 600 | table.hgraph div.bar { |
601 | background-color: #eee; | 601 | background-color: #eee; |
602 | height: 1em; | 602 | height: 1em; |
603 | } | 603 | } |
604 | 604 | ||
605 | table.ssdiff { | 605 | table.ssdiff { |
606 | width: 100%; | 606 | width: 100%; |
607 | } | 607 | } |
608 | 608 | ||
609 | table.ssdiff td { | 609 | table.ssdiff td { |
610 | font-size: 75%; | 610 | font-size: 75%; |
611 | font-family: monospace; | 611 | font-family: monospace; |
612 | white-space: pre; | 612 | white-space: pre; |
613 | padding: 1px 4px 1px 4px; | 613 | padding: 1px 4px 1px 4px; |
614 | border-left: solid 1px #aaa; | 614 | border-left: solid 1px #aaa; |
615 | border-right: solid 1px #aaa; | 615 | border-right: solid 1px #aaa; |
616 | } | 616 | } |
617 | 617 | ||
618 | table.ssdiff td.add { | 618 | table.ssdiff td.add { |
619 | color: black; | 619 | color: black; |
620 | background: #cfc; | 620 | background: #cfc; |
621 | min-width: 50%; | 621 | min-width: 50%; |
622 | } | 622 | } |
623 | 623 | ||
624 | table.ssdiff td.add_dark { | 624 | table.ssdiff td.add_dark { |
625 | color: black; | 625 | color: black; |
626 | background: #aca; | 626 | background: #aca; |
627 | min-width: 50%; | 627 | min-width: 50%; |
628 | } | 628 | } |
629 | 629 | ||
630 | table.ssdiff span.add { | ||
631 | background: #cfc; | ||
632 | font-weight: bold; | ||
633 | } | ||
634 | |||
630 | table.ssdiff td.del { | 635 | table.ssdiff td.del { |
631 | color: black; | 636 | color: black; |
632 | background: #fcc; | 637 | background: #fcc; |
633 | min-width: 50%; | 638 | min-width: 50%; |
634 | } | 639 | } |
635 | 640 | ||
636 | table.ssdiff td.del_dark { | 641 | table.ssdiff td.del_dark { |
637 | color: black; | 642 | color: black; |
638 | background: #caa; | 643 | background: #caa; |
639 | min-width: 50%; | 644 | min-width: 50%; |
640 | } | 645 | } |
641 | 646 | ||
647 | table.ssdiff span.del { | ||
648 | background: #fcc; | ||
649 | font-weight: bold; | ||
650 | } | ||
651 | |||
642 | table.ssdiff td.changed { | 652 | table.ssdiff td.changed { |
643 | color: black; | 653 | color: black; |
644 | background: #ffc; | 654 | background: #ffc; |
645 | min-width: 50%; | 655 | min-width: 50%; |
646 | } | 656 | } |
647 | 657 | ||
648 | table.ssdiff td.changed_dark { | 658 | table.ssdiff td.changed_dark { |
649 | color: black; | 659 | color: black; |
650 | background: #cca; | 660 | background: #cca; |
651 | min-width: 50%; | 661 | min-width: 50%; |
652 | } | 662 | } |
653 | 663 | ||
654 | table.ssdiff td.lineno { | 664 | table.ssdiff td.lineno { |
655 | color: black; | 665 | color: black; |
656 | background: #eee; | 666 | background: #eee; |
657 | text-align: right; | 667 | text-align: right; |
658 | width: 3em; | 668 | width: 3em; |
659 | min-width: 3em; | 669 | min-width: 3em; |
660 | } | 670 | } |
661 | 671 | ||
662 | table.ssdiff td.hunk { | 672 | table.ssdiff td.hunk { |
663 | color: #black; | 673 | color: #black; |
664 | background: #ccf; | 674 | background: #ccf; |
665 | border-top: solid 1px #aaa; | 675 | border-top: solid 1px #aaa; |
666 | border-bottom: solid 1px #aaa; | 676 | border-bottom: solid 1px #aaa; |
667 | } | 677 | } |
668 | 678 | ||
669 | table.ssdiff td.head { | 679 | table.ssdiff td.head { |
670 | border-top: solid 1px #aaa; | 680 | border-top: solid 1px #aaa; |
671 | border-bottom: solid 1px #aaa; | 681 | border-bottom: solid 1px #aaa; |
672 | } | 682 | } |
673 | 683 | ||
674 | table.ssdiff td.head div.head { | 684 | table.ssdiff td.head div.head { |
675 | font-weight: bold; | 685 | font-weight: bold; |
676 | color: black; | 686 | color: black; |
677 | } | 687 | } |
678 | 688 | ||
679 | table.ssdiff td.foot { | 689 | table.ssdiff td.foot { |
680 | border-top: solid 1px #aaa; | 690 | border-top: solid 1px #aaa; |
681 | border-left: none; | 691 | border-left: none; |
682 | border-right: none; | 692 | border-right: none; |
683 | border-bottom: none; | 693 | border-bottom: none; |
684 | } | 694 | } |
685 | 695 | ||
686 | table.ssdiff td.space { | 696 | table.ssdiff td.space { |
687 | border: none; | 697 | border: none; |
688 | } | 698 | } |
689 | 699 | ||