Eskil

Check-in [c9caad7929]
Login

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

Overview
Comment:Preserve line endings when saving during Edit Mode.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: c9caad792989a717076dff108c451d792a45f1ef
User & Date: peter 2016-09-04 21:37:52.783
Context
2017-01-12
00:04
Added -gz flag to compare compressed files. check-in: 1b678887d0 user: peter tags: trunk
2016-09-04
21:37
Preserve line endings when saving during Edit Mode. check-in: c9caad7929 user: peter tags: trunk
2016-08-30
21:44
Corrected uv path check-in: de4b342c4f user: peter tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to Changes.



1
2
3
4
5
6
7



2016-08-30
 Bumped revision to 2.7.3

2016-08-21
 Autodetect semicolon separaort. Connect GUI separator with plugin.

2016-08-19
>
>
>







1
2
3
4
5
6
7
8
9
10
2016-09-04
 Preserve line endings when saving during Edit Mode.

2016-08-30
 Bumped revision to 2.7.3

2016-08-21
 Autodetect semicolon separaort. Connect GUI separator with plugin.

2016-08-19
Changes to htdocs/download.html.
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24

<h2>Version 2.7.3</h2><ul>
<li><a href="../../../uv/htdocs/download/eskil273.kit">eskil273.kit</a>
&nbsp;&nbsp;&nbsp;<small>(1271818 bytes)</small> (<a href="http://wiki.tcl.tk/starkit">Starkit</a>)
<li><a href="../../../uv/htdocs/download/eskil273.linux.gz">eskil273.linux.gz</a>
&nbsp;&nbsp;&nbsp;<small>(4510733 bytes)</small> (<a href="http://wiki.tcl.tk/starpack">Starpack</a> for Linux)
<li><a href="../../../uv/htdocs/download/eskil273.win.zip">eskil273.win.zip</a>
&nbsp;&nbsp;&nbsp;<small>(2900678 bytes)</small> (<a href="http://wiki.tcl.tk/starpack">Starpack</a> for Windows)
<li><a href="../../../uv/htdocs/download/eskil273.mac.gz">eskil273.mac.gz</a>
&nbsp;&nbsp;&nbsp;<small>(3201758 bytes)</small> (<a href="http://wiki.tcl.tk/starpack">Starpack</a> for Mac)
</ul>

<h2>Version 2.7.2</h2><ul>
<li><a href="../../../../downloads-2.7.2/eskil272.kit">eskil272.kit</a>
&nbsp;&nbsp;&nbsp;<small>(1268542 bytes)</small> (<a href="http://wiki.tcl.tk/starkit">Starkit</a>)







|







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24

<h2>Version 2.7.3</h2><ul>
<li><a href="../../../uv/htdocs/download/eskil273.kit">eskil273.kit</a>
&nbsp;&nbsp;&nbsp;<small>(1271818 bytes)</small> (<a href="http://wiki.tcl.tk/starkit">Starkit</a>)
<li><a href="../../../uv/htdocs/download/eskil273.linux.gz">eskil273.linux.gz</a>
&nbsp;&nbsp;&nbsp;<small>(4510733 bytes)</small> (<a href="http://wiki.tcl.tk/starpack">Starpack</a> for Linux)
<li><a href="../../../uv/htdocs/download/eskil273.win.zip">eskil273.win.zip</a>
&nbsp;&nbsp;&nbsp;<small>(4414313 bytes)</small> (<a href="http://wiki.tcl.tk/starpack">Starpack</a> for Windows)
<li><a href="../../../uv/htdocs/download/eskil273.mac.gz">eskil273.mac.gz</a>
&nbsp;&nbsp;&nbsp;<small>(3201758 bytes)</small> (<a href="http://wiki.tcl.tk/starpack">Starpack</a> for Mac)
</ul>

<h2>Version 2.7.2</h2><ul>
<li><a href="../../../../downloads-2.7.2/eskil272.kit">eskil272.kit</a>
&nbsp;&nbsp;&nbsp;<small>(1268542 bytes)</small> (<a href="http://wiki.tcl.tk/starkit">Starkit</a>)
Changes to src/eskil.tcl.
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892

    # Turn off ignore
    set ::Pref(ignore) " "
    set ::Pref(nocase) 0
    set ::Pref(noempty) 0

    # Try to autodetect line endings in file
    set ch [open $file rb]
    set data [read $ch 10000]
    close $ch
    if {[string first \r\n $data] >= 0} {
        set ::eskil($top,mergetranslation) crlf
    } else {
        set ::eskil($top,mergetranslation) lf
    }
}

# Read a conflict file and extract the two versions.
proc prepareConflict {top} {
    disallowEdit $top
    set ::eskil($top,leftFile) [tmpFile]
    set ::eskil($top,rightFile) [tmpFile]







<
<
<
<
|
<
<
<







871
872
873
874
875
876
877




878



879
880
881
882
883
884
885

    # Turn off ignore
    set ::Pref(ignore) " "
    set ::Pref(nocase) 0
    set ::Pref(noempty) 0

    # Try to autodetect line endings in file




    detectLineEnd $top $file mergetranslation lf



}

# Read a conflict file and extract the two versions.
proc prepareConflict {top} {
    disallowEdit $top
    set ::eskil($top,leftFile) [tmpFile]
    set ::eskil($top,rightFile) [tmpFile]
1278
1279
1280
1281
1282
1283
1284



1285
1286
1287
1288
1289
1290
1291
    if {$::eskil($top,mode) eq "rev"} {
        prepareRev $top
        lappend ::eskil($top,cleanup) "rev"
    } elseif {$::eskil($top,mode) eq "conflict"} {
        prepareConflict $top
        lappend ::eskil($top,cleanup) "conflict"
    }



    # Prepare Separator
    set ::eskil($top,separator) \
            [subst -nocommands -novariables $::eskil($top,separatorview)]
    # Autodetect separator before any plugin processing
    if {$::eskil($top,view) eq "table" && $::eskil($top,separator) eq ""} {
        set ch1 [open $::eskil($top,leftFile)]
        gets $ch1 line1







>
>
>







1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
    if {$::eskil($top,mode) eq "rev"} {
        prepareRev $top
        lappend ::eskil($top,cleanup) "rev"
    } elseif {$::eskil($top,mode) eq "conflict"} {
        prepareConflict $top
        lappend ::eskil($top,cleanup) "conflict"
    }
    # Try to autodetect line endings in files
    detectLineEnd $top $::eskil($top,rightFile) righttranslation
    detectLineEnd $top $::eskil($top,leftFile)  lefttranslation
    # Prepare Separator
    set ::eskil($top,separator) \
            [subst -nocommands -novariables $::eskil($top,separatorview)]
    # Autodetect separator before any plugin processing
    if {$::eskil($top,view) eq "table" && $::eskil($top,separator) eq ""} {
        set ch1 [open $::eskil($top,leftFile)]
        gets $ch1 line1
1754
1755
1756
1757
1758
1759
1760














1761
1762
1763
1764
1765
1766
1767

#####################################
# Editing
#####################################

# FIXA: Use snit to adapt text widget instead of using wcb
# include seeText in such a snidget.















# Clear Editing state
proc resetEdit {top} {
    set ::eskil($top,leftEdit) 0
    set ::eskil($top,rightEdit) 0
    $top.m.mt entryconfigure "Edit Mode" -state normal








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







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

#####################################
# Editing
#####################################

# FIXA: Use snit to adapt text widget instead of using wcb
# include seeText in such a snidget.

# Try to autodetect line endings in file
proc detectLineEnd {top file field {def {}}} {
    set ch [open $file rb]
    set data [read $ch 1000]
    close $ch
    if {[string first \r\n $data] >= 0} {
        set ::eskil($top,$field) crlf
    } elseif {[string first \n $data] >= 0} {
        set ::eskil($top,$field) lf
    } else {
        set ::eskil($top,$field) $def
    }
}

# Clear Editing state
proc resetEdit {top} {
    set ::eskil($top,leftEdit) 0
    set ::eskil($top,rightEdit) 0
    $top.m.mt entryconfigure "Edit Mode" -state normal

2057
2058
2059
2060
2061
2062
2063

2064
2065
2066

2067
2068
2069
2070
2071
2072
2073
    return 0
}

proc saveFile {top side} {
    if {$side == 1} {
        if {!$::eskil($top,leftEdit)} return
        set fileName $::eskil($top,leftFile)

    } else {
        if {!$::eskil($top,rightEdit)} return
        set fileName $::eskil($top,rightFile)

    }

    set w $::widgets($top,wDiff$side)

    # Confirm dialog
    set apa [tk_messageBox -parent $top -icon question \
            -title "Overwrite file" -type yesnocancel -message \







>



>







2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
    return 0
}

proc saveFile {top side} {
    if {$side == 1} {
        if {!$::eskil($top,leftEdit)} return
        set fileName $::eskil($top,leftFile)
        set trans $::eskil($top,lefttranslation)
    } else {
        if {!$::eskil($top,rightEdit)} return
        set fileName $::eskil($top,rightFile)
        set trans $::eskil($top,righttranslation)
    }

    set w $::widgets($top,wDiff$side)

    # Confirm dialog
    set apa [tk_messageBox -parent $top -icon question \
            -title "Overwrite file" -type yesnocancel -message \
2082
2083
2084
2085
2086
2087
2088



2089
2090
2091
2092
2093
2094
2095
            return
        }
    } elseif {$apa ne "no"} {
        return
    }

    set ch [open $fileName "w"]



    set save 1
    foreach {key value index} [$w dump -all 1.0 end-1c] {
        switch -- $key {
            text {
                if {$save} {
                    puts -nonewline $ch $value
                }







>
>
>







2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
            return
        }
    } elseif {$apa ne "no"} {
        return
    }

    set ch [open $fileName "w"]
    if {$trans ne ""} {
        fconfigure $ch -translation $trans
    }
    set save 1
    foreach {key value index} [$w dump -all 1.0 end-1c] {
        switch -- $key {
            text {
                if {$save} {
                    puts -nonewline $ch $value
                }
Changes to src/merge.tcl.
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
    fillMergeWindow $top
}

# Compare each file against an ancestor file for three-way merge
proc collectAncestorInfo {top dFile1 dFile2 opts} {
    if {![info exists ::eskil($top,mergetranslation)]} {
        # Try to autodetect line endings in ancestor file
        set ch [open $::eskil($top,ancestorFile) rb]
        set data [read $ch 10000]
        close $ch
        if {[string first \r\n $data] >= 0} {
            set ::eskil($top,mergetranslation) crlf
        } else {
            set ::eskil($top,mergetranslation) lf
        }
    }
    array unset ::eskil $top,ancestorLeft,*
    array unset ::eskil $top,ancestorRight,*
    set differrA1 [catch {DiffUtil::diffFiles {*}$opts \
            $::eskil($top,ancestorFile) $dFile1} diffresA1]
    set differrA2 [catch {DiffUtil::diffFiles {*}$opts \
            $::eskil($top,ancestorFile) $dFile2} diffresA2]







|
<
<
<
<
<
<
<







493
494
495
496
497
498
499
500







501
502
503
504
505
506
507
    fillMergeWindow $top
}

# Compare each file against an ancestor file for three-way merge
proc collectAncestorInfo {top dFile1 dFile2 opts} {
    if {![info exists ::eskil($top,mergetranslation)]} {
        # Try to autodetect line endings in ancestor file
        detectLineEnd $top $::eskil($top,ancestorFile) mergetranslation lf







    }
    array unset ::eskil $top,ancestorLeft,*
    array unset ::eskil $top,ancestorRight,*
    set differrA1 [catch {DiffUtil::diffFiles {*}$opts \
            $::eskil($top,ancestorFile) $dFile1} diffresA1]
    set differrA2 [catch {DiffUtil::diffFiles {*}$opts \
            $::eskil($top,ancestorFile) $dFile2} diffresA2]