33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
-
+
|
# Stop Tk from meddling with the command line by copying it first.
set ::eskil(argv) $::argv
set ::eskil(argc) $::argc
set ::argv {}
set ::argc 0
set ::eskil(debug) 0
set ::eskil(diffver) "Version 2.7+ 2015-03-17"
set ::eskil(diffver) "Version 2.7+ 2015-04-19"
set ::eskil(thisScript) [file join [pwd] [info script]]
namespace import tcl::mathop::+
namespace import tcl::mathop::-
namespace import tcl::mathop::*
namespace import tcl::mathop::/
|
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
|
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
|
+
+
+
+
+
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
|
set n1 [llength $block1]
set n2 [llength $block2]
# Is this a change block, a delete block or an insert block?
if {$n1 == 0} {set tag2 new2} else {set tag2 change}
if {$n2 == 0} {set tag1 new1} else {set tag1 change}
if {$n1 == $n2} {
# This should only happen for equal sized blocks that were deemed
# too large for block parsing.
foreach line1 $block1 line2 $block2 {
insertMatchingLines $top $line1 $line2
}
} else {
foreach line $block1 {
insertLine $top 1 $doingLine1 $line $tag1
incr doingLine1
}
foreach line $block2 {
insertLine $top 2 $doingLine2 $line $tag2
incr doingLine2
foreach line $block1 {
insertLine $top 1 $doingLine1 $line $tag1
incr doingLine1
}
foreach line $block2 {
insertLine $top 2 $doingLine2 $line $tag2
incr doingLine2
}
}
if {$n1 <= $n2} {
for {set t $n1} {$t < $n2} {incr t} {
emptyLine $top 1
}
addChange $top $n2 $tag2 $line1 $n1 $line2 $n2
nextHighlight $top
|
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
|
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
|
-
+
-
+
|
# Insert two blocks of lines in the compare windows.
proc insertMatchingBlocks {top block1 block2 line1 line2 details} {
global doingLine1 doingLine2
set n1 [llength $block1]
set n2 [llength $block2]
set large [expr {$n1 * $n2 > 1000}]
set large [expr {$n1 * $n2 > 5000}]
if {$n1 == 0 || $n2 == 0 || $::Pref(parse) < 2 || \
($large && $::Pref(parse) < 3)} {
# No extra parsing at all.
insertMatchingBlocksNoParse $top $block1 $block2 $line1 $line2 $details
return
}
# A large block may take time. Give a small warning.
if {$large} {
if {$n1 * $n2 > 2000} {
set ::widgets($top,eqLabel) "!"
update idletasks
}
# Detect if only newlines has changed within the block, e.g.
# when rearranging newlines.
if {$::eskil(ignorenewline)} {
|