Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Added incremental search. Updated documentation. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
19acdf27274af761acf886795ead7f88 |
User & Date: | spjutp 2001-10-26 08:22:22.000 |
Context
2001-10-26
| ||
11:42 | Added search function made by Ulf Nilsson. check-in: 210c6423c4 user: spjutp tags: trunk | |
08:22 | Added incremental search. Updated documentation. check-in: 19acdf2727 user: spjutp tags: trunk | |
2001-05-04
| ||
13:36 | Patch display missed the last patch. Printing did not handle tabs well. check-in: c18e99bea8 user: spjutp tags: trunk | |
Changes
Changes to src/eskil.tcl.
︙ | ︙ | |||
44 45 46 47 48 49 50 | #----------------------------------------------- # $Revision$ #----------------------------------------------- # the next line restarts using wish \ exec wish "$0" "$@" set debug 1 | | | 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | #----------------------------------------------- # $Revision$ #----------------------------------------------- # the next line restarts using wish \ exec wish "$0" "$@" set debug 1 set diffver "Version 1.8.5 2001-10-25" set tmpcnt 0 set tmpfiles {} set thisscript [file join [pwd] [info script]] set thisdir [file dirname $thisscript] if {$tcl_platform(platform) == "windows"} { cd $thisdir |
︙ | ︙ | |||
985 986 987 988 989 990 991 | displayOnePatch $leftLines $rightLines $leftLine $rightLine } set leftLines {} set rightLines {} set state none continue } | | | | | | | 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 | displayOnePatch $leftLines $rightLines $leftLine $rightLine } set leftLines {} set rightLines {} set state none continue } # Detect the first line in a -c style diff if {$state == "none" && [regexp {^\*\*\*} $line]} { set state newfile set style c set leftRE {^\*\*\*\s+(.*)$} set rightRE {^---\s+(.*)$} } # Detect the first line in a -u style diff if {$state == "none" && [regexp {^---} $line]} { set state newfile set style u set leftRE {^---\s+(.*)$} set rightRE {^\+\+\+\s+(.*)$} } if {$state == "newfile" && [regexp $leftRE $line -> sub]} { emptyline 1 insert 1 "" $divider insert 1 "" $sub insert 1 "" $divider continue } if {$state == "newfile" && [regexp $rightRE $line -> sub]} { emptyline 2 insert 2 "" $divider insert 2 "" $sub insert 2 "" $divider continue } # A new section in a -u style diff if {[regexp {^@@\s+-(\d+),\d+\s+\+(\d+),} $line -> sub1 sub2]} { if {$state == "both"} { displayOnePatch $leftLines $rightLines $leftLine $rightLine } set state both set leftLine $sub1 set rightLine $sub2 set leftLines {} set rightLines {} continue } # A new section in a -c style diff if {[regexp {^\*\*\*\*\*} $line]} { if {$state == "right"} { displayOnePatch $leftLines $rightLines $leftLine $rightLine } set leftLines {} set rightLines {} set state left continue } # We are in the left part of a -c style diff if {$state == "left"} { if {[regexp {^\*\*\*\s*(\d*)} $line -> sub]} { if {$sub != ""} { set leftLine $sub } continue } |
︙ | ︙ | |||
1057 1058 1059 1060 1061 1062 1063 | if {![regexp {^[\s!+-]} $line]} continue lappend leftLines [list $leftLine \ [string trim [string range $line 0 1]] \ [string range $line 2 end]] incr leftLine continue } | | | | 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 | if {![regexp {^[\s!+-]} $line]} continue lappend leftLines [list $leftLine \ [string trim [string range $line 0 1]] \ [string range $line 2 end]] incr leftLine continue } # We are in the right part of a -c style diff if {$state == "right"} { if {![regexp {^[\s!+-]} $line]} continue lappend rightLines [list $rightLine \ [string trim [string range $line 0 1]] \ [string range $line 2 end]] incr rightLine continue } # We are in a -u style diff if {$state == "both"} { if {![regexp {^[\s+-]} $line]} continue set sig [string trim [string index $line 0]] set str [string range $line 1 end] if {$sig == ""} { lappend leftLines [list $leftLine "" $str] lappend rightLines [list $leftLine "" $str] |
︙ | ︙ | |||
1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 | grid $w.sbx x -sticky we grid columnconfigure $w 0 -weight 1 grid rowconfigure $w 1 -weight 1 collectMergeData fillMergeWindow } ##################################### # Printing stuff ##################################### # Format a line number for printing proc formatLineno {lineno gray} { | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 | grid $w.sbx x -sticky we grid columnconfigure $w 0 -weight 1 grid rowconfigure $w 1 -weight 1 collectMergeData fillMergeWindow } ##################################### # Searching ##################################### proc startIncrementalSearch {w} { if {![info exists ::diff(isearch)]} { set ::diff(isearch) "" set ::diff(isearchlast) "" } # This shouldn't happen if {$::diff(isearch) != ""} { endIncrementalSearch $w } set ::diff(isearch) $w bind MyText <Control-Key-s> "isearchAgain %W ; break" bind MyText <FocusOut> "endIncrementalSearch %W" bind MyText <Key> "isearchKey %W %A ; break" bind MyText <Key-Escape> "endIncrementalSearch %W ; break" bind MyText <Control-Key-g> "endIncrementalSearch %W ; break" bind MyText <Key-Delete> "isearchBack %W ; break" bind MyText <Key-BackSpace> "isearchBack %W ; break" set ::diff(isearchstring) "" set ::diff(isearchhistory) {} set ::diff(isearchindex) [$w index insert] } proc isearchShow {w index string} { if {$index != $::diff(isearchindex)} { $w tag remove sel 1.0 end } $w tag add sel $index "$index + [string length $string] chars" $w mark set insert $index $w see $index set ::diff(isearchindex) $index set ::diff(isearchstring) $string set ::diff(isearchlast) $string } proc isearchAgain {w} { if {$w != $::diff(isearch)} { bell endIncrementalSearch $::diff(isearch) return } set str $::diff(isearchstring) if {$str == ""} { set str $::diff(isearchlast) } set found [$w search $str "$::diff(isearchindex) + 1 char"] if {$found == ""} { bell return } lappend ::diff(isearchhistory) $::diff(isearchindex) \ $::diff(isearchstring) isearchShow $w $found $str } proc isearchKey {w key} { if {$w != $::diff(isearch)} { bell endIncrementalSearch $::diff(isearch) return } if {$key == ""} return set str $::diff(isearchstring) append str $key set found [$w search $str $::diff(isearchindex)] if {$found == ""} { bell return } lappend ::diff(isearchhistory) $::diff(isearchindex) \ $::diff(isearchstring) isearchShow $w $found $str } proc isearchBack {w} { if {$w != $::diff(isearch)} { bell endIncrementalSearch $::diff(isearch) return } if {[llength $::diff(isearchhistory)] < 2} { bell return } set str [lindex $::diff(isearchhistory) end] set found [lindex $::diff(isearchhistory) end-1] set ::diff(isearchhistory) [lrange $::diff(isearchhistory) 0 end-2] isearchShow $w $found $str } proc endIncrementalSearch {w} { set ::diff(isearch) "" # Remove all bindings from MyText foreach b [bind MyText] { bind MyText $b "" } bind MyText <Control-Key-s> "startIncrementalSearch %W" } ##################################### # Printing stuff ##################################### # Format a line number for printing proc formatLineno {lineno gray} { |
︙ | ︙ | |||
2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 | -font myfont -borderwidth 0 -padx 0 -highlightthickness 0 text .ft2.tt -height 60 -width 80 -wrap none -yscrollcommand my_yscroll \ -xscrollcommand ".sbx2 set" -font myfont -borderwidth 0 -padx 0 \ -highlightthickness 0 pack .ft2.tl -side left -fill y pack .ft2.tt -side right -fill both -expand 1 scrollbar .sbx2 -orient horizontal -command ".ft2.tt xview" label .le -textvariable eqLabel -width 1 canvas .c -width 6 -bd 0 -selectborderwidth 0 -highlightthickness 0 applyColor .ft1.tt tag configure last -underline 1 .ft2.tt tag configure last -underline 1 foreach w {.ft1.tt .ft1.tl .ft2.tt .ft2.tl} { | > > > > > | 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 | -font myfont -borderwidth 0 -padx 0 -highlightthickness 0 text .ft2.tt -height 60 -width 80 -wrap none -yscrollcommand my_yscroll \ -xscrollcommand ".sbx2 set" -font myfont -borderwidth 0 -padx 0 \ -highlightthickness 0 pack .ft2.tl -side left -fill y pack .ft2.tt -side right -fill both -expand 1 scrollbar .sbx2 -orient horizontal -command ".ft2.tt xview" bind MyText <Control-Key-s> "startIncrementalSearch %W" bindtags .ft1.tt "MyText [bindtags .ft1.tt]" bindtags .ft2.tt "MyText [bindtags .ft2.tt]" label .le -textvariable eqLabel -width 1 canvas .c -width 6 -bd 0 -selectborderwidth 0 -highlightthickness 0 applyColor .ft1.tt tag configure last -underline 1 .ft2.tt tag configure last -underline 1 foreach w {.ft1.tt .ft1.tl .ft2.tt .ft2.tl} { |
︙ | ︙ | |||
2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 | chFont } # Update example font proc exampleFont {} { global TmpPref set i [lindex [.fo.lb curselection] 0] set TmpPref(fontfamily) [.fo.lb get $i] font configure tmpfont -family $TmpPref(fontfamily) | > | | 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 | chFont } # Update example font proc exampleFont {} { global TmpPref set i [lindex [.fo.lb curselection] 0] if {$i == ""} return set TmpPref(fontfamily) [.fo.lb get $i] font configure tmpfont -family $TmpPref(fontfamily) if {[string is integer -strict $TmpPref(fontsize)]} { font configure tmpfont -size $TmpPref(fontsize) } } # Font dialog proc makeFontWin {} { global Pref TmpPref FontCache |
︙ | ︙ | |||
2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 | File Menu Redo Diff : Run diff again on the same files. Open Both : Select two files, run diff. Open Left File : Select a file for left window, run diff Open Right File : Select a file for right window, run diff Open Conflict File: Select a file containing conflicts such as from a CVS merge. RCSDiff : (UNIX only) Select one file and diff like rcsdiff. CVSDiff : (UNIX only) Select one file and diff like cvs diff. Print : (UNIX only) Experimental print function. It currently creates a postscript file ~/tcldiff.ps Quit : Guess Options Menu | > | 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 | File Menu Redo Diff : Run diff again on the same files. Open Both : Select two files, run diff. Open Left File : Select a file for left window, run diff Open Right File : Select a file for right window, run diff Open Conflict File: Select a file containing conflicts such as from a CVS merge. Open Patch File : Display a patch file created by diff -c or diff -u. RCSDiff : (UNIX only) Select one file and diff like rcsdiff. CVSDiff : (UNIX only) Select one file and diff like cvs diff. Print : (UNIX only) Experimental print function. It currently creates a postscript file ~/tcldiff.ps Quit : Guess Options Menu |
︙ | ︙ | |||
2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 | if there are no more diffs. Next Diff Button: Scrolls to the next differing block, or to the bottom if there are no more diffs. Equal sign: Above the vertical scrollbar, a "=" will appear if the files are equal. } "" {Merge Window (Appears in conflict mode)} ul { You can, for each difference, select which version you want to appear in the output file. The buttons "LR", "L", "R" and "RL" select the lines from the left file, right file or both files. "Prev" and "Next" buttons moves between differences. "All L" and "All R" buttons select "L" or "R" for all differences. | > > > > > > > > > > > > > | 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 | if there are no more diffs. Next Diff Button: Scrolls to the next differing block, or to the bottom if there are no more diffs. Equal sign: Above the vertical scrollbar, a "=" will appear if the files are equal. } "" {Bindings} ul { Up, Down, Page Up and Page Down scrolls main windows. Escape takes focus out of text windows. Right mouse button "zooms" a line of text. Ctrl-s starts incremental search. Incremental search is stopped by Escape or Ctrl-g. Ctrl-f brings up search dialog. F3 is "search again". } "" {Merge Window (Appears in conflict mode)} ul { You can, for each difference, select which version you want to appear in the output file. The buttons "LR", "L", "R" and "RL" select the lines from the left file, right file or both files. "Prev" and "Next" buttons moves between differences. "All L" and "All R" buttons select "L" or "R" for all differences. |
︙ | ︙ | |||
2884 2885 2886 2887 2888 2889 2890 | are passed to diff. [file1],[file2] Files to be compared If no files are given, the program is started anyway and you can select files from within. If only one file is given, the program looks for an RCS/CVS directory next to the | | | | | | | > | | | | | | > > > > | | | > > > | 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 | are passed to diff. [file1],[file2] Files to be compared If no files are given, the program is started anyway and you can select files from within. If only one file is given, the program looks for an RCS/CVS directory next to the file, and if found, runs in RCS/CVS mode. Options: -nodiff : Normally, if there are enough information on the command line to run diff, diff.tcl will do so unless this option is specified. -noparse : Diff.tcl can perform analysis of changed blocks to -line : improve display. See online help for details. -smallblock : The default. Do block analysis on small blocks. -block : Full block analysis. This can be slow if there are large change blocks. -char : The analysis of changes can be done on either -word : character or word basis. -char is the default. -2nd : Turn on or off second stage parsing. -no2nd : It is on by default. -noignore : Don't ignore any whitespace. -b : Ignore space changes. Default. -w : Ignore all spaces. -conflict : Treat file as a merge conflict file and enter merge mode. -o <file> : Specify merge result output file. -browse : Automatically bring up file dialog after starting. -server : Set up diff to be controllable from the outside. -print <file> : Generate postscript and exit. } } proc parseCommandLine {} { global diff Pref |
︙ | ︙ | |||
2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 | set Pref(ignore) "-b" } elseif {$arg == "-noignore"} { set Pref(ignore) " " } elseif {$arg == "-noparse"} { set Pref(parse) 0 } elseif {$arg == "-line"} { set Pref(parse) 1 } elseif {$arg == "-block"} { set Pref(parse) 3 } elseif {$arg == "-char"} { set Pref(lineparsewords) 0 } elseif {$arg == "-word"} { set Pref(lineparsewords) 1 } elseif {$arg == "-2nd"} { | > > | 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 | set Pref(ignore) "-b" } elseif {$arg == "-noignore"} { set Pref(ignore) " " } elseif {$arg == "-noparse"} { set Pref(parse) 0 } elseif {$arg == "-line"} { set Pref(parse) 1 } elseif {$arg == "-smallblock"} { set Pref(parse) 2 } elseif {$arg == "-block"} { set Pref(parse) 3 } elseif {$arg == "-char"} { set Pref(lineparsewords) 0 } elseif {$arg == "-word"} { set Pref(lineparsewords) 1 } elseif {$arg == "-2nd"} { |
︙ | ︙ |