693
# -- Cleanup uninteresting diff header lines.
694
#
695
if {[string match {diff --git *} $line]} continue
696
+ if {[string match {diff --cc *} $line]} continue
697
if {[string match {diff --combined *} $line]} continue
698
if {[string match {--- *} $line]} continue
699
if {[string match {+++ *} $line]} continue
705
#
706
if {[string match {@@@ *} $line]} {set is_3way_diff 1}
707
707
- # -- Reformat a 3 way diff, 'cause its too weird.
708
- #
709
- if {$is_3way_diff} {
708
+ if {[string match {index *} $line]} {
709
+ set tags {}
710
+ } elseif {$is_3way_diff} {
711
set op [string range $line 0 1]
712
switch -- $op {
713
+ { } {set tags {}}
714
{@@} {set tags d_@}
713
- {++} {set tags d_+ ; set op { +}}
714
- {--} {set tags d_- ; set op { -}}
715
- { +} {set tags d_++; set op {++}}
716
- { -} {set tags d_--; set op {--}}
717
- {+ } {set tags d_-+; set op {-+}}
718
- {- } {set tags d_+-; set op {+-}}
719
- default {set tags {}}
715
+ { +} {set tags d_s+}
716
+ { -} {set tags d_s-}
717
+ {+ } {set tags d_+s}
718
+ {- } {set tags d_-s}
719
+ {--} {set tags d_--}
720
+ {++} {
721
+ if {[regexp {^\+\+([<>]{7} |={7})} $line _g op]} {
722
+ set line [string replace $line 0 1 { }]
723
+ set tags d$op
724
+ } else {
725
+ set tags d_++
726
+ }
727
+ }
728
+ default {
729
+ puts "error: Unhandled 3 way diff marker: {$op}"
730
+ set tags {}
731
+ }
732
}
721
- set line [string replace $line 0 1 $op]
733
} else {
723
- switch -- [string index $line 0] {
724
- @ {set tags d_@}
725
- + {set tags d_+}
726
- - {set tags d_-}
727
- default {set tags {}}
734
+ set op [string index $line 0]
735
+ switch -- $op {
736
+ { } {set tags {}}
737
+ {@} {set tags d_@}
738
+ {-} {set tags d_-}
739
+ {+} {
740
+ if {[regexp {^\+([<>]{7} |={7})} $line _g op]} {
741
+ set line [string replace $line 0 0 { }]
742
+ set tags d$op
743
+ } else {
744
+ set tags d_+
745
+ }
746
+ }
747
+ default {
748
+ puts "error: Unhandled 2 way diff marker: {$op}"
749
+ set tags {}
750
+ }
751
}
752
}
753
$ui_diff insert end $line $tags
3879
pack .vpane.lower.diff.body -side bottom -fill both -expand 1
3880
3881
$ui_diff tag conf d_@ -font font_diffbold
3859
-$ui_diff tag conf d_+ -foreground blue
3860
-$ui_diff tag conf d_- -foreground red
3861
-$ui_diff tag conf d_++ -foreground {#00a000}
3862
-$ui_diff tag conf d_-- -foreground {#a000a0}
3863
-$ui_diff tag conf d_+- \
3864
- -foreground red \
3865
- -background {light goldenrod yellow}
3866
-$ui_diff tag conf d_-+ \
3882
+$ui_diff tag conf d_+ -foreground blue
3883
+$ui_diff tag conf d_- -foreground red
3884
+
3885
+$ui_diff tag conf d_++ -foreground blue
3886
+$ui_diff tag conf d_-- -foreground red
3887
+$ui_diff tag conf d_+s \
3888
-foreground blue \
3889
-background azure2
3890
+$ui_diff tag conf d_-s \
3891
+ -foreground red \
3892
+ -background azure2
3893
+$ui_diff tag conf d_s+ \
3894
+ -foreground blue \
3895
+ -background {light goldenrod yellow}
3896
+$ui_diff tag conf d_s- \
3897
+ -foreground red \
3898
+ -background {light goldenrod yellow}
3899
+
3900
+$ui_diff tag conf d<<<<<<< \
3901
+ -foreground orange \
3902
+ -font font_diffbold
3903
+$ui_diff tag conf d======= \
3904
+ -foreground orange \
3905
+ -font font_diffbold
3906
+$ui_diff tag conf d>>>>>>> \
3907
+ -foreground orange \
3908
+ -font font_diffbold
3909
3910
# -- Diff Body Context Menu
3911
#