Fossil SCM

Add the "Invert" button to the --tk diff display.

drh 2014-04-01 19:52 trunk
Commit cf52a9ab7bbff4f36d5206596263691c6ee718d8
1 file changed +27 -1
+27 -1
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -943,13 +943,39 @@
943943
@ foreach e $::difftxt {puts $out [list $e]}
944944
@ puts $out "\175"
945945
@ puts $out "eval \$prog"
946946
@ close $out
947947
@ }
948
+@ proc invertDiff {} {
949
+@ global CFG
950
+@ array set x [grid info .txtA]
951
+@ if {$x(-column)==1} {
952
+@ grid config .lnB -column 0
953
+@ grid config .txtB -column 1
954
+@ .txtB tag config add -background $CFG(RM_BG)
955
+@ grid config .lnA -column 3
956
+@ grid config .txtA -column 4
957
+@ .txtA tag config rm -background $CFG(ADD_BG)
958
+@ } else {
959
+@ grid config .lnA -column 0
960
+@ grid config .txtA -column 1
961
+@ .txtA tag config rm -background $CFG(RM_BG)
962
+@ grid config .lnB -column 3
963
+@ grid config .txtB -column 4
964
+@ .txtB tag config add -background $CFG(ADD_BG)
965
+@ }
966
+@ .mkr config -state normal
967
+@ set clt [.mkr search -all < 1.0 end]
968
+@ set cgt [.mkr search -all > 1.0 end]
969
+@ foreach c $clt {.mkr replace $c "$c +1 chars" >}
970
+@ foreach c $cgt {.mkr replace $c "$c +1 chars" <}
971
+@ .mkr config -state disabled
972
+@ }
948973
@ ::ttk::button .bb.quit -text {Quit} -command exit
974
+@ ::ttk::button .bb.invert -text {Invert} -command invertDiff
949975
@ ::ttk::button .bb.save -text {Save As...} -command saveDiff
950
-@ pack .bb.quit -side left
976
+@ pack .bb.quit .bb.invert -side left
951977
@ if {$fossilcmd!=""} {pack .bb.save -side left}
952978
@ pack .bb.files -side left
953979
@ grid rowconfigure . 1 -weight 1
954980
@ grid columnconfigure . 1 -weight 1
955981
@ grid columnconfigure . 4 -weight 1
956982
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -943,13 +943,39 @@
943 @ foreach e $::difftxt {puts $out [list $e]}
944 @ puts $out "\175"
945 @ puts $out "eval \$prog"
946 @ close $out
947 @ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
948 @ ::ttk::button .bb.quit -text {Quit} -command exit
 
949 @ ::ttk::button .bb.save -text {Save As...} -command saveDiff
950 @ pack .bb.quit -side left
951 @ if {$fossilcmd!=""} {pack .bb.save -side left}
952 @ pack .bb.files -side left
953 @ grid rowconfigure . 1 -weight 1
954 @ grid columnconfigure . 1 -weight 1
955 @ grid columnconfigure . 4 -weight 1
956
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -943,13 +943,39 @@
943 @ foreach e $::difftxt {puts $out [list $e]}
944 @ puts $out "\175"
945 @ puts $out "eval \$prog"
946 @ close $out
947 @ }
948 @ proc invertDiff {} {
949 @ global CFG
950 @ array set x [grid info .txtA]
951 @ if {$x(-column)==1} {
952 @ grid config .lnB -column 0
953 @ grid config .txtB -column 1
954 @ .txtB tag config add -background $CFG(RM_BG)
955 @ grid config .lnA -column 3
956 @ grid config .txtA -column 4
957 @ .txtA tag config rm -background $CFG(ADD_BG)
958 @ } else {
959 @ grid config .lnA -column 0
960 @ grid config .txtA -column 1
961 @ .txtA tag config rm -background $CFG(RM_BG)
962 @ grid config .lnB -column 3
963 @ grid config .txtB -column 4
964 @ .txtB tag config add -background $CFG(ADD_BG)
965 @ }
966 @ .mkr config -state normal
967 @ set clt [.mkr search -all < 1.0 end]
968 @ set cgt [.mkr search -all > 1.0 end]
969 @ foreach c $clt {.mkr replace $c "$c +1 chars" >}
970 @ foreach c $cgt {.mkr replace $c "$c +1 chars" <}
971 @ .mkr config -state disabled
972 @ }
973 @ ::ttk::button .bb.quit -text {Quit} -command exit
974 @ ::ttk::button .bb.invert -text {Invert} -command invertDiff
975 @ ::ttk::button .bb.save -text {Save As...} -command saveDiff
976 @ pack .bb.quit .bb.invert -side left
977 @ if {$fossilcmd!=""} {pack .bb.save -side left}
978 @ pack .bb.files -side left
979 @ grid rowconfigure . 1 -weight 1
980 @ grid columnconfigure . 1 -weight 1
981 @ grid columnconfigure . 4 -weight 1
982

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button