Eskil

Check-in [6846909aaf]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Work on table view
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 6846909aaf172b6d84d429dae7d3587d044833f9
User & Date: peter 2015-04-15 21:46:01.337
Context
2015-04-19
17:02
Adjusted block parsing. Raised the limit for large. check-in: 9ddc5b7e98 user: peter tags: trunk
2015-04-15
21:46
Work on table view check-in: 6846909aaf user: peter tags: trunk
2015-04-12
21:40
Started on table view check-in: 6a189c234c user: peter tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to examples/dir1/csv1.txt.
1
2
3
4

5
6
7
8
9
10
11
head1,head2,head3,head4,head5,head6,head7,head8,head9,head10
MCPM,JFPC,FJ9S9,J1J,CC3,72<C,;P>HJ,RN?I,O48,BH<<
RKBO,@P:,GGG0,=8FNP,P6K,I@4,44H,48RG,1ODB:,SN:O?
CM7,M75,PML7@,I1:,EMRL,KHK,J3IQ,N4:CJ,2H:F=,L;9I

9R6,MQPJA,BL1,0NCR,6BEH0,DC=,D@F,I9J19,L8M99,DQHEE
GGK,OB?PM,I9S;K,060,AHO=8,JC46O,J>=,11?,QNEP,I1Q
:9E<C,P1S,R=PG?,SI=,<P0L5,6<C5<,=P?5E,E5HE?,@L=,N=P=1
0>A,3LPO,>27,BHA6,A3<,ODLH,01?L5,HL<D,SPR>J,KF>S=
601,QK<26,1H>,PAQ,H2P,C@=,J?59<,;MG,E>8KF,BD6I
M>SR,KA3L,PJG,HMF=G,<79I,B3;4<,1>D,JOPM,K:R7,HK<
CK9NB,G;10O,<M6=,>K2;,S6>7,O12KG,@RM,QN>,=<1<,D?CJ




>







1
2
3
4
5
6
7
8
9
10
11
12
head1,head2,head3,head4,head5,head6,head7,head8,head9,head10
MCPM,JFPC,FJ9S9,J1J,CC3,72<C,;P>HJ,RN?I,O48,BH<<
RKBO,@P:,GGG0,=8FNP,P6K,I@4,44H,48RG,1ODB:,SN:O?
CM7,M75,PML7@,I1:,EMRL,KHK,J3IQ,N4:CJ,2H:F=,L;9I
a,b,c,d,e,f,g,h,i,j
9R6,MQPJA,BL1,0NCR,6BEH0,DC=,D@F,I9J19,L8M99,DQHEE
GGK,OB?PM,I9S;K,060,AHO=8,JC46O,J>=,11?,QNEP,I1Q
:9E<C,P1S,R=PG?,SI=,<P0L5,6<C5<,=P?5E,E5HE?,@L=,N=P=1
0>A,3LPO,>27,BHA6,A3<,ODLH,01?L5,HL<D,SPR>J,KF>S=
601,QK<26,1H>,PAQ,H2P,C@=,J?59<,;MG,E>8KF,BD6I
M>SR,KA3L,PJG,HMF=G,<79I,B3;4<,1>D,JOPM,K:R7,HK<
CK9NB,G;10O,<M6=,>K2;,S6>7,O12KG,@RM,QN>,=<1<,D?CJ
Changes to examples/dir2/csv1.txt.
21
22
23
24
25
26
27

28
29
30
31
63N,1RG,HS9,7AR=,2G8P,SGS,5IH1H,7QD0,=15Q,NC5
FBH;;,H@2S?,21N?,;NMCG,D4S<,<>R,73HHF,4=2,?J?7,C0;
KPG64,QI442,3OCQ,50C2K,M>9C,>9<,CNA1J,>9Q,@RJ4S,899
3;RS,H3;@5,<73,1OAL,J=85K,PI6,OIA,FQ4S,H?53P,;SBD4
?==,<0A;,:3;Q,3FH,<3N,=D0,ASSH,:>M,E44I,5S:
RRHBE,0A1M:,DKLIA,=DM,KA:@,66S6,=193,6G;6E,H92,<J4B
:72,6DH6O,OBI,5GOB,0R39:,<<C,LFQ<,<297,2E;MO,<S9AI

A6LN,RD2S,AD20,F7:9,7PJ4@,O@4:9,O92,60I,1AE<,LBN
<NOC,;;9,DAI,C;@<<,?1P1,P?LEM,2GC,::IC,S=DO,?<GIS
;MS,K5HM,8HEP,<0=N,5HJC,15P@O,MSORD,9;NF,R;>@,MS?BR
KPFLI,A>LCB,Q:?C,D49J?,KKCI,<@LM8,A06GB,?=R:>,72P,EME







>




21
22
23
24
25
26
27
28
29
30
31
32
63N,1RG,HS9,7AR=,2G8P,SGS,5IH1H,7QD0,=15Q,NC5
FBH;;,H@2S?,21N?,;NMCG,D4S<,<>R,73HHF,4=2,?J?7,C0;
KPG64,QI442,3OCQ,50C2K,M>9C,>9<,CNA1J,>9Q,@RJ4S,899
3;RS,H3;@5,<73,1OAL,J=85K,PI6,OIA,FQ4S,H?53P,;SBD4
?==,<0A;,:3;Q,3FH,<3N,=D0,ASSH,:>M,E44I,5S:
RRHBE,0A1M:,DKLIA,=DM,KA:@,66S6,=193,6G;6E,H92,<J4B
:72,6DH6O,OBI,5GOB,0R39:,<<C,LFQ<,<297,2E;MO,<S9AI
a,b,c,d,e,f,g,h,i,j
A6LN,RD2S,AD20,F7:9,7PJ4@,O@4:9,O92,60I,1AE<,LBN
<NOC,;;9,DAI,C;@<<,?1P1,P?LEM,2GC,::IC,S=DO,?<GIS
;MS,K5HM,8HEP,<0=N,5HJC,15P@O,MSORD,9;NF,R;>@,MS?BR
KPFLI,A>LCB,Q:?C,D49J?,KKCI,<@LM8,A06GB,?=R:>,72P,EME
Changes to src/eskil.syntax.
57
58
59
60
61
62
63




64
65
66
67
68
69
70
##nagelfar syntax twapi::set_focus x
##nagelfar syntax twapi::send_keys x
##nagelfar syntax twapi::get_window_coordinates x
##nagelfar package known twapi

##nagelfar syntax tablelist::tablelist x p*
##nagelfar syntax tablelist::convEventFields x x x




##nagelfar package known tablelist_tile

##nagelfar syntax MySpinBox x p*
##nagelfar option MySpinBox -textvariable -from -to -increment -width -format
##nagelfar option MySpinBox\ -textvariable n

# Operators







>
>
>
>







57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
##nagelfar syntax twapi::set_focus x
##nagelfar syntax twapi::send_keys x
##nagelfar syntax twapi::get_window_coordinates x
##nagelfar package known twapi

##nagelfar syntax tablelist::tablelist x p*
##nagelfar syntax tablelist::convEventFields x x x
##nagelfar syntax tablelist::synchronize x
##nagelfar syntax tablelist::cellIndex x x x
##nagelfar syntax tablelist::findTabs x x x x n n
##nagelfar syntax mwutil::wrongNumArgs x
##nagelfar package known tablelist_tile

##nagelfar syntax MySpinBox x p*
##nagelfar option MySpinBox -textvariable -from -to -increment -width -format
##nagelfar option MySpinBox\ -textvariable n

# Operators
Changes to src/eskil.tcl.
49
50
51
52
53
54
55
















56
57
58
59
60
61
62
# This is not run until needed to speed up command line error reporting.
proc Init {} {
    package require Tk 8.4
    catch {package require textSearch}
    package require wcb
    package require snit
    package require tablelist_tile

















    if {[catch {package require psballoon}]} {
        # Add a dummy if it does not exist.
        proc addBalloon {args} {}
    } else {
        namespace import -force psballoon::addBalloon
    }







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# This is not run until needed to speed up command line error reporting.
proc Init {} {
    package require Tk 8.4
    catch {package require textSearch}
    package require wcb
    package require snit
    package require tablelist_tile

    # Patch tablelist to add cellbodyindex subcommand
    lappend ::tablelist::cmdOpts cellbodyindex
    proc tablelist::cellbodyindexSubCmd {win argList} {
        if {[llength $argList] != 1} {
            mwutil::wrongNumArgs "$win cellbodyindex cellIndex"
        }

        synchronize $win
        foreach {row col} [cellIndex $win [lindex $argList 0] 1] {}
        findTabs $win [expr {$row + 1}] $col $col tabIdx1 tabIdx2
        upvar ::tablelist::ns${win}::data data
        set cIdx1 [$data(body) index "$tabIdx1 + 1 char"]
        set cIdx2 [$data(body) index "$tabIdx2 - 1 char"]
        return [list $cIdx1 $cIdx2]
    }

    if {[catch {package require psballoon}]} {
        # Add a dummy if it does not exist.
        proc addBalloon {args} {}
    } else {
        namespace import -force psballoon::addBalloon
    }
355
356
357
358
359
360
361

















362
363
364
365
366
367
368
369
370
371
372
373




374
375
376
377
378
379
380
        }
        set ::tmpfiles {}
    }
}

# Insert lineno and text
proc insertLine {top n line text {tag {equal}} {linetag {}}} {

















    $::widgets($top,wDiff$n) insert end "$text\n" $tag
    if {$linetag ne ""} {
        append tag " $linetag"
    }
    if {$tag != "equal"} {
        set tag "hl$::HighLightCount $tag"
    }
    $::widgets($top,wLine$n) insert end [myFormL $line] $tag
}

# Insert an empty line on one side of the diff.
proc emptyLine {top n {highlight 1}} {




    if {$highlight} {
        $::widgets($top,wLine$n) insert end "\n" hl$::HighLightCount
    } else {
        $::widgets($top,wLine$n) insert end "*****\n"
    }
    $::widgets($top,wDiff$n) insert end "\n" padding
}







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>












>
>
>
>







371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
        }
        set ::tmpfiles {}
    }
}

# Insert lineno and text
proc insertLine {top n line text {tag {equal}} {linetag {}}} {
    if {$::eskil($top,view) eq "table"} {
        set RE $::eskil($top,separator)
        set words [split $text $RE]
        set col 0
        set id [$::widgets($top,wTable) insert end {}]
        foreach w $words {
            $::widgets($top,wTable) cellconfigure $id,$col -text $w
            if {$tag ne "equal"} {
                lassign [$::widgets($top,wTable) cellbodyindex $id,$col] \
                        cIdx1 cIdx2
                set body [$::widgets($top,wTable) bodypath]
                $body tag add new$n "$cIdx1"            "$cIdx2 + 1 char"
            }
            incr col
        }
        return
    }
    $::widgets($top,wDiff$n) insert end "$text\n" $tag
    if {$linetag ne ""} {
        append tag " $linetag"
    }
    if {$tag != "equal"} {
        set tag "hl$::HighLightCount $tag"
    }
    $::widgets($top,wLine$n) insert end [myFormL $line] $tag
}

# Insert an empty line on one side of the diff.
proc emptyLine {top n {highlight 1}} {
    if {$::eskil($top,view) eq "table"} {
        # This should be ignored for table
        return
    }
    if {$highlight} {
        $::widgets($top,wLine$n) insert end "\n" hl$::HighLightCount
    } else {
        $::widgets($top,wLine$n) insert end "*****\n"
    }
    $::widgets($top,wDiff$n) insert end "\n" padding
}
445
446
447
448
449
450
451

































452
453
454
455
456
457
458
    return $res
}

# Insert one line in each text widget.
# Mark them as changed, and optionally parse them.
proc insertMatchingLines {top line1 line2} {
    global doingLine1 doingLine2


































    # FIXA: fully implement filter
    if {$::eskil(filter) != ""} {
        if {[regexp $::eskil(filter) $line1]} {
            insertLine $top 1 $doingLine1 $line1
            insertLine $top 2 $doingLine2 $line2
            incr doingLine1







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
    return $res
}

# Insert one line in each text widget.
# Mark them as changed, and optionally parse them.
proc insertMatchingLines {top line1 line2} {
    global doingLine1 doingLine2

    if {$::eskil($top,view) eq "table"} {
        set opts $::Pref(ignore)
        if {$::Pref(nocase)} {lappend opts -nocase}
        if {$::Pref(lineparsewords)} {lappend opts -words}
        set RE $::eskil($top,separator)
        set words1 [split $line1 $RE]
        set words2 [split $line2 $RE]
        set col 0
        set id [$::widgets($top,wTable) insert end {}]
        foreach w1 $words1 w2 $words2 {
            set r [DiffUtil::diffStrings {*}$opts $w1 $w2]
            if {[llength $r] <= 2} {
                # Equal
                $::widgets($top,wTable) cellconfigure $id,$col -text $w1
            } else {
                # TBD TABLE, simple display for now
                $::widgets($top,wTable) cellconfigure $id,$col -text $w1$w2
                lassign [$::widgets($top,wTable) cellbodyindex $id,$col] \
                        cIdx1 cIdx2
                set body [$::widgets($top,wTable) bodypath]
                set l1 [string length $w1]
                set l2 [expr {$l1 + 1}]
                set l3 [expr {$l1 + [string length $w2]}]
                $body tag add new1 "$cIdx1"            "$cIdx1 + $l1 char"
                $body tag add new2 "$cIdx1 + $l1 char" "$cIdx1 + $l3 char"
            }
            incr col
        }
        incr doingLine1
        incr doingLine2
        return
    }

    # FIXA: fully implement filter
    if {$::eskil(filter) != ""} {
        if {[regexp $::eskil(filter) $line1]} {
            insertLine $top 1 $doingLine1 $line1
            insertLine $top 2 $doingLine2 $line2
            incr doingLine1
727
728
729
730
731
732
733




734
735
736
737
738
739



740
741
742
743
744
745
746
747
748
749
750



751
752
753
754

755
756
757
758
759
760
761
762
763



764
765
766
767

768
769
770
771
772
773
774
            incr t2
        } elseif {$c eq "C"} {
            # This is two lines that the block matching considered
            # too different to use line parsing on them.
            # Marked the whole line as deleted/inserted
            set textline1 [lindex $block1 $t1]
            set textline2 [lindex $block2 $t2]




            $::widgets($top,wLine1) insert end [myFormL $doingLine1] \
                    "hl$::HighLightCount change"
            $::widgets($top,wDiff1) insert end "$textline1\n" new1
            $::widgets($top,wLine2) insert end [myFormL $doingLine2] \
                    "hl$::HighLightCount change"
            $::widgets($top,wDiff2) insert end "$textline2\n" new2



            if {$finegrain} {
                addChange $top 1 change [expr {$line1 + $t1}] 1 \
                        [expr {$line2 + $t2}] 1
                nextHighlight $top
            }
            incr doingLine1
            incr doingLine2
            incr t1
            incr t2
        } elseif {$c eq "d"} {
            set bepa [lindex $block1 $t1]



            $::widgets($top,wLine1) insert end [myFormL $doingLine1] \
                    "hl$::HighLightCount change"
            $::widgets($top,wDiff1) insert end "$bepa\n" new1
            emptyLine $top 2

            incr doingLine1
            if {$finegrain} {
                addChange $top 1 new1 [expr {$line1 + $t1}] 1 \
                        [expr {$line2 + $t2}] 0
                nextHighlight $top
            }
            incr t1
        } elseif {$c eq "a"} {
            set bepa [lindex $block2 $t2]



            $::widgets($top,wLine2) insert end [myFormL $doingLine2] \
                    "hl$::HighLightCount change"
            $::widgets($top,wDiff2) insert end "$bepa\n" new2
            emptyLine $top 1

            incr doingLine2
            if {$finegrain} {
                addChange $top 1 new2 [expr {$line1 + $t1}] 0 \
                        [expr {$line2 + $t2}] 1
                nextHighlight $top
            }
            incr t2







>
>
>
>
|
|
|
|
|
|
>
>
>





<
<




>
>
>
|
|
|
|
>









>
>
>
|
|
|
|
>







797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821


822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
            incr t2
        } elseif {$c eq "C"} {
            # This is two lines that the block matching considered
            # too different to use line parsing on them.
            # Marked the whole line as deleted/inserted
            set textline1 [lindex $block1 $t1]
            set textline2 [lindex $block2 $t2]
            if {$::eskil($top,view) eq "table"} {
                # Fall back to proc that handles table
                insertMatchingLines $top $textline1 $textline2
            } else {
                $::widgets($top,wLine1) insert end [myFormL $doingLine1] \
                        "hl$::HighLightCount change"
                $::widgets($top,wDiff1) insert end "$textline1\n" new1
                $::widgets($top,wLine2) insert end [myFormL $doingLine2] \
                        "hl$::HighLightCount change"
                $::widgets($top,wDiff2) insert end "$textline2\n" new2
                incr doingLine1
                incr doingLine2
            }
            if {$finegrain} {
                addChange $top 1 change [expr {$line1 + $t1}] 1 \
                        [expr {$line2 + $t2}] 1
                nextHighlight $top
            }


            incr t1
            incr t2
        } elseif {$c eq "d"} {
            set bepa [lindex $block1 $t1]
            if {$::eskil($top,view) eq "table"} {
                insertLine $top 1 $doingLine1 $bepa new1
            } else {
                $::widgets($top,wLine1) insert end [myFormL $doingLine1] \
                        "hl$::HighLightCount change"
                $::widgets($top,wDiff1) insert end "$bepa\n" new1
                emptyLine $top 2
            }
            incr doingLine1
            if {$finegrain} {
                addChange $top 1 new1 [expr {$line1 + $t1}] 1 \
                        [expr {$line2 + $t2}] 0
                nextHighlight $top
            }
            incr t1
        } elseif {$c eq "a"} {
            set bepa [lindex $block2 $t2]
            if {$::eskil($top,view) eq "table"} {
                insertLine $top 2 $doingLine2 $bepa new2
            } else {
                $::widgets($top,wLine2) insert end [myFormL $doingLine2] \
                        "hl$::HighLightCount change"
                $::widgets($top,wDiff2) insert end "$bepa\n" new2
                emptyLine $top 1
            }
            incr doingLine2
            if {$finegrain} {
                addChange $top 1 new2 [expr {$line1 + $t1}] 0 \
                        [expr {$line2 + $t2}] 1
                nextHighlight $top
            }
            incr t2
817
818
819
820
821
822
823

824
825
826
827
828
829
830

831
832
833
834
835
836
837
                if {$line2 > 0 && $doingLine2 > $line2} break
                insertLine $top 2 $doingLine2 $apa
                incr doingLine2
                addMapLines $top 1
                incr t
                if {$limit >= 0 && $t >= $limit} break
            }

            set t 0
            while {[gets $ch1 apa] != -1} {
                if {$line1 > 0 && $doingLine1 > $line1} break
                insertLine $top 1 $doingLine1 $apa
                incr doingLine1
                incr t
                if {$limit >= 0 && $t >= $limit} break

            }
        }
        return
    }

    # Is this a change block, a delete block or an insert block?
    if {$n1 == 0} {set tag2 new2} else {set tag2 change}







>
|
|
|
|
|
|
|
>







900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
                if {$line2 > 0 && $doingLine2 > $line2} break
                insertLine $top 2 $doingLine2 $apa
                incr doingLine2
                addMapLines $top 1
                incr t
                if {$limit >= 0 && $t >= $limit} break
            }
            if {$::eskil($top,view) ne "table"} {
                set t 0
                while {[gets $ch1 apa] != -1} {
                    if {$line1 > 0 && $doingLine1 > $line1} break
                    insertLine $top 1 $doingLine1 $apa
                    incr doingLine1
                    incr t
                    if {$limit >= 0 && $t >= $limit} break
                }
            }
        }
        return
    }

    # Is this a change block, a delete block or an insert block?
    if {$n1 == 0} {set tag2 new2} else {set tag2 change}
855
856
857
858
859
860
861

862

863
864
865
866
867
868
869
    set t 0
    while {$doingLine1 < $line1} {
        gets $ch1 apa
        gets $ch2 bepa
        if {$limit < 0 || ($t < $limit && $allowStartFill) || \
                ($line1 - $doingLine1) <= $limit} {
            insertLine $top 1 $doingLine1 $apa

            insertLine $top 2 $doingLine2 $bepa

            addMapLines $top 1
        } elseif {$t == $limit && $allowStartFill} {
            # If zero context is shown, skip the filler to keep display tight.
            if {$limit > 0} {
                emptyLine $top 1 0
                emptyLine $top 2 0
                addMapLines $top 1







>
|
>







940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
    set t 0
    while {$doingLine1 < $line1} {
        gets $ch1 apa
        gets $ch2 bepa
        if {$limit < 0 || ($t < $limit && $allowStartFill) || \
                ($line1 - $doingLine1) <= $limit} {
            insertLine $top 1 $doingLine1 $apa
            if {$::eskil($top,view) ne "table"} {
                insertLine $top 2 $doingLine2 $bepa
            }
            addMapLines $top 1
        } elseif {$t == $limit && $allowStartFill} {
            # If zero context is shown, skip the filler to keep display tight.
            if {$limit > 0} {
                emptyLine $top 1 0
                emptyLine $top 2 0
                addMapLines $top 1
952
953
954
955
956
957
958





959
960
961
962
963
964
965
966
967
            $w config -cursor watch
        }
    }
}

proc normalCursor {top} {
    global oldcursor oldcursor2





    $top config -cursor $oldcursor
    foreach item {wLine1 wDiff1 wLine2 wDiff2} {
        if {[info exists ::widgets($top,$item)]} {
            set w $::widgets($top,$item)
            $w config -cursor $oldcursor2
        }
    }
}








>
>
>
>
>

|







1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
            $w config -cursor watch
        }
    }
}

proc normalCursor {top} {
    global oldcursor oldcursor2
    if {$::eskil($top,view) eq "table"} {
        set items wTable
    } else {
        set items {wLine1 wDiff1 wLine2 wDiff2}
    }
    $top config -cursor $oldcursor
    foreach item $items {
        if {[info exists ::widgets($top,$item)]} {
            set w $::widgets($top,$item)
            $w config -cursor $oldcursor2
        }
    }
}

1574
1575
1576
1577
1578
1579
1580









1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
        } else {
            # First lines are equal, treat them as header
            # Consume table header line
            gets $ch1 line1
            incr doingLine1
            gets $ch2 line
            incr doingLine2









            set headings [split $line1 $::eskil($top,separator)]
            set col {}
            foreach heading $headings {
                lappend col 0 $heading
            }
            $::widgets($top,wTable) configure -columns $col
        }
    }

    # TBD TABLE, stop for now
    if {$::eskil($top,view) eq "table"} {
        return
    }

    # If there is a range, skip lines up to the range
    if {[llength $range] != 0} {
        disallowEdit $top
        lassign $range start1 end1 start2 end2
        while {$doingLine1 < $start1 && [gets $ch1 line] >= 0} {
            incr doingLine1
        }







>
>
>
>
>
>
>
>
>









<
<
<
<
<







1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690





1691
1692
1693
1694
1695
1696
1697
        } else {
            # First lines are equal, treat them as header
            # Consume table header line
            gets $ch1 line1
            incr doingLine1
            gets $ch2 line
            incr doingLine2
            if {$::eskil($top,separator) eq ""} {
                # Autodetect separator
                # Any tab?
                if {[regsub -all "\t" $line1 "\t" _] >= 2} {
                    set ::eskil($top,separator) "\t"
                } elseif {[regsub -all "," $line1 "," _] >= 2} {
                    set ::eskil($top,separator) ","
                } 
            }
            set headings [split $line1 $::eskil($top,separator)]
            set col {}
            foreach heading $headings {
                lappend col 0 $heading
            }
            $::widgets($top,wTable) configure -columns $col
        }
    }






    # If there is a range, skip lines up to the range
    if {[llength $range] != 0} {
        disallowEdit $top
        lassign $range start1 end1 start2 end2
        while {$doingLine1 < $start1 && [gets $ch1 line] >= 0} {
            incr doingLine1
        }
1627
1628
1629
1630
1631
1632
1633

1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647

1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676

1677
1678
1679
1680
1681
1682

1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699

1700
1701
1702
1703
1704
1705
1706
        lassign $range start1 end1 start2 end2
    } else {
        set end1 0
        set end2 0
    }
    doText $top $ch1 $ch2 0 0 $end1 $end2


    # Make sure all text widgets have the same number of lines.
    # The common y scroll doesn't work well if not.
    set max 0.0
    foreach item {wLine1 wDiff1 wLine2 wDiff2} {
        set w $::widgets($top,$item)
        if {[$w index end] > $max} {
            set max [$w index end]
        }
    }
    foreach item {wLine1 wDiff1 wLine2 wDiff2} {
        set w $::widgets($top,$item)
        set d [expr {int($max) - int([$w index end])}]
        for {set t 0} {$t < $d} {incr t} {
            $w insert end \n padding

        }
    }

    close $ch1
    close $ch2

    # We can turn off editing in the text windows after everything
    # is displayed.
    noEdit $top

    # Mark aligned lines
    if {[info exists ::eskil($top,aligns)] && \
            [llength $::eskil($top,aligns)] > 0} {
        foreach {align1 align2} $::eskil($top,aligns) {
            set i [$::widgets($top,wLine1) search -regexp "\\m$align1\\M" 1.0]
            if {$i != ""} {
                $::widgets($top,wLine1) tag add align \
                        "$i linestart" "$i lineend"
            }
            set i [$::widgets($top,wLine2) search -regexp "\\m$align2\\M" 1.0]
            if {$i != ""} {
                $::widgets($top,wLine2) tag add align \
                        "$i linestart" "$i lineend"
            }
        }
    }

    drawMap $top -1
    #drawEditButtons $top

    foreach item {wLine1 wLine2 wTb} {
        set w $::widgets($top,$item)
        $w configure -state disabled
    }
    update idletasks
    $::widgets($top,wLine2) see 1.0

    normalCursor $top
    showDiff $top 0
    if {$::widgets($top,eqLabel) eq "!"} {
        set ::widgets($top,eqLabel) " "
    }

    cleanupFiles $top
    if {$::eskil($top,mode) eq "conflict"} {
        if {$::widgets($top,eqLabel) != "="} {
            makeMergeWin $top
        }
    } elseif {$::eskil($top,ancestorFile) ne ""} {
        if {$::widgets($top,eqLabel) != "="} {
            makeMergeWin $top
        }
    }
    if {$::eskil($top,printFile) ne ""} {

        after idle "doPrint $top 1 ; cleanupAndExit all"
    }
}

# This is the entrypoint to do a diff via DDE or Send
proc remoteDiff {file1 file2} {
    newDiff $file1 $file2







>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
>










|


















>
|
|
|
|
|
|
>

















>







1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
        lassign $range start1 end1 start2 end2
    } else {
        set end1 0
        set end2 0
    }
    doText $top $ch1 $ch2 0 0 $end1 $end2

    if {$::eskil($top,view) ne "table"} {
        # Make sure all text widgets have the same number of lines.
        # The common y scroll doesn't work well if not.
        set max 0.0
        foreach item {wLine1 wDiff1 wLine2 wDiff2} {
            set w $::widgets($top,$item)
            if {[$w index end] > $max} {
                set max [$w index end]
            }
        }
        foreach item {wLine1 wDiff1 wLine2 wDiff2} {
            set w $::widgets($top,$item)
            set d [expr {int($max) - int([$w index end])}]
            for {set t 0} {$t < $d} {incr t} {
                $w insert end \n padding
            }
        }
    }

    close $ch1
    close $ch2

    # We can turn off editing in the text windows after everything
    # is displayed.
    noEdit $top

    # Mark aligned lines TBD TABLE
    if {[info exists ::eskil($top,aligns)] && \
            [llength $::eskil($top,aligns)] > 0} {
        foreach {align1 align2} $::eskil($top,aligns) {
            set i [$::widgets($top,wLine1) search -regexp "\\m$align1\\M" 1.0]
            if {$i != ""} {
                $::widgets($top,wLine1) tag add align \
                        "$i linestart" "$i lineend"
            }
            set i [$::widgets($top,wLine2) search -regexp "\\m$align2\\M" 1.0]
            if {$i != ""} {
                $::widgets($top,wLine2) tag add align \
                        "$i linestart" "$i lineend"
            }
        }
    }

    drawMap $top -1
    #drawEditButtons $top
    if {$::eskil($top,view) ne "table"} {
        foreach item {wLine1 wLine2 wTb} {
            set w $::widgets($top,$item)
            $w configure -state disabled
        }
        update idletasks
        $::widgets($top,wLine2) see 1.0
    }
    normalCursor $top
    showDiff $top 0
    if {$::widgets($top,eqLabel) eq "!"} {
        set ::widgets($top,eqLabel) " "
    }

    cleanupFiles $top
    if {$::eskil($top,mode) eq "conflict"} {
        if {$::widgets($top,eqLabel) != "="} {
            makeMergeWin $top
        }
    } elseif {$::eskil($top,ancestorFile) ne ""} {
        if {$::widgets($top,eqLabel) != "="} {
            makeMergeWin $top
        }
    }
    if {$::eskil($top,printFile) ne ""} {
        # TBD TABLE
        after idle "doPrint $top 1 ; cleanupAndExit all"
    }
}

# This is the entrypoint to do a diff via DDE or Send
proc remoteDiff {file1 file2} {
    newDiff $file1 $file2
1750
1751
1752
1753
1754
1755
1756


1757
1758
1759
1760
1761
1762
1763
        $::widgets($top,wLine2) tag configure hl$::eskil($top,currHighLight) \
                -background yellow
    }
}

# Highlight a diff and scroll windows to it.
proc showDiff {top num} {


    highLightChange $top $num

    set change [lindex $::eskil($top,changes) $::eskil($top,currHighLight)]
    set line1 [lindex $change 0]

    if {$::eskil($top,currHighLight) < 0} {
        set line1 1.0







>
>







1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
        $::widgets($top,wLine2) tag configure hl$::eskil($top,currHighLight) \
                -background yellow
    }
}

# Highlight a diff and scroll windows to it.
proc showDiff {top num} {
    # TBD TABLE
    if {$::eskil($top,view) eq "table"} return
    highLightChange $top $num

    set change [lindex $::eskil($top,changes) $::eskil($top,currHighLight)]
    set line1 [lindex $change 0]

    if {$::eskil($top,currHighLight) < 0} {
        set line1 1.0
2726
2727
2728
2729
2730
2731
2732




2733
2734
2735
2736
2737
2738
2739

    set ::eskil($top,nopopup) 1
    tk_popup .lpm $X $Y
    after idle [list after 1 [list set "::eskil($top,nopopup)" 0]]
}

proc nextHighlight {top} {




    set tag hl$::HighLightCount
    foreach n {1 2} {
        $::widgets($top,wLine$n) tag bind $tag <ButtonPress-3> \
                "hlPopup $top $n $::HighLightCount %X %Y %x %y ; break"
        $::widgets($top,wLine$n) tag bind $tag <ButtonPress-1> \
                "hlSelect $top $::HighLightCount"
    }







>
>
>
>







2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846

    set ::eskil($top,nopopup) 1
    tk_popup .lpm $X $Y
    after idle [list after 1 [list set "::eskil($top,nopopup)" 0]]
}

proc nextHighlight {top} {
    # TBD TABLE, stop for now?
    if {$::eskil($top,view) eq "table"} {
        return
    }
    set tag hl$::HighLightCount
    foreach n {1 2} {
        $::widgets($top,wLine$n) tag bind $tag <ButtonPress-3> \
                "hlPopup $top $n $::HighLightCount %X %Y %x %y ; break"
        $::widgets($top,wLine$n) tag bind $tag <ButtonPress-1> \
                "hlSelect $top $::HighLightCount"
    }
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272





3273
3274
3275
3276
3277
3278
3279
3280

3281
3282
3283
3284
3285
3286
3287
        # Single frame for contents
        ttk::frame $top.ft -borderwidth 2 -relief sunken
        grid $top.l1   $top.l2  -row 1 -sticky news
        grid $top.ft   -        -row 2 -sticky news
        grid columnconfigure $top "$top.ft" -weight 1
        grid rowconfigure $top $top.ft      -weight 1
        # TBD TABLE
        tablelist::tablelist $top.ft.tab -height 20 \
                -movablecolumns no -setgrid no -showseparators no \
                -fullseparators yes -selectmode none
        ttk::scrollbar $top.ft.vsb -orient vertical \
                -command "$top.ft.tab yview"
        ttk::scrollbar $top.ft.hsb -orient horizontal \
                -command "$top.ft.tab xview"
        $top.ft.tab configure -yscrollcommand "$top.ft.vsb set" \
                -xscrollcommand "$top.ft.hsb set"






        set bg [ttk::style configure . -background]
        set map [createMap $top $bg]
        
        grid $top.ft.tab $top.ft.vsb $map -sticky news
        grid $top.ft.hsb x           x    -sticky news
        grid columnconfigure $top.ft 0 -weight 1
        grid rowconfigure    $top.ft 0 -weight 1

        set ::widgets($top,wTable) $top.ft.tab
    } else {
        ttk::frame $top.ft1 -borderwidth 2 -relief sunken
        text $top.ft1.tl -height $::Pref(lines) -width 5 -wrap none \
                -font myfont -borderwidth 0 -padx 0 -highlightthickness 0 \
                -takefocus 0
        text $top.ft1.tt -height $::Pref(lines) -width $::Pref(linewidth) \







|








>
>
>
>
>








>







3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
        # Single frame for contents
        ttk::frame $top.ft -borderwidth 2 -relief sunken
        grid $top.l1   $top.l2  -row 1 -sticky news
        grid $top.ft   -        -row 2 -sticky news
        grid columnconfigure $top "$top.ft" -weight 1
        grid rowconfigure $top $top.ft      -weight 1
        # TBD TABLE
        tablelist::tablelist $top.ft.tab -height 20 -width 80 \
                -movablecolumns no -setgrid no -showseparators no \
                -fullseparators yes -selectmode none
        ttk::scrollbar $top.ft.vsb -orient vertical \
                -command "$top.ft.tab yview"
        ttk::scrollbar $top.ft.hsb -orient horizontal \
                -command "$top.ft.tab xview"
        $top.ft.tab configure -yscrollcommand "$top.ft.vsb set" \
                -xscrollcommand "$top.ft.hsb set"
        set body [$top.ft.tab bodypath]
        $body tag configure new1 -foreground $::Pref(colornew1) \
                -background $::Pref(bgnew1)
        $body tag configure new2 -foreground $::Pref(colornew2) \
                -background $::Pref(bgnew2)

        set bg [ttk::style configure . -background]
        set map [createMap $top $bg]
        
        grid $top.ft.tab $top.ft.vsb $map -sticky news
        grid $top.ft.hsb x           x    -sticky news
        grid columnconfigure $top.ft 0 -weight 1
        grid rowconfigure    $top.ft 0 -weight 1
        grid $map -pady [expr {[winfo reqwidth $top.ft.vsb] - 2}]
        set ::widgets($top,wTable) $top.ft.tab
    } else {
        ttk::frame $top.ft1 -borderwidth 2 -relief sunken
        text $top.ft1.tl -height $::Pref(lines) -width 5 -wrap none \
                -font myfont -borderwidth 0 -padx 0 -highlightthickness 0 \
                -takefocus 0
        text $top.ft1.tt -height $::Pref(lines) -width $::Pref(linewidth) \