Fossil SCM

Better control over the blue/red/green colors in the --tk TCL code.

drh 2021-09-02 18:44 diff-color-enhancements
Commit 1df8b9d773b850b45fb14292a12efe2fa20466447c7d2c1bf17f66d0d8a61d46
1 file changed +10 -2
+10 -2
--- src/diff.tcl
+++ src/diff.tcl
@@ -136,12 +136,20 @@
136136
if {$x ne ""} {
137137
.txtA insert end $x -
138138
.txtB insert end $x -
139139
}
140140
if {$i+2<$nn} {
141
- .txtA insert end [lindex $line [expr {$i+1}]] chng
142
- .txtB insert end [lindex $line [expr {$i+2}]] chng
141
+ set x1 [lindex $line [expr {$i+1}]]
142
+ set x2 [lindex $line [expr {$i+2}]]
143
+ if {"$x1" eq ""} {
144
+ .txtB insert end $x2 add
145
+ } elseif {"$x2" eq ""} {
146
+ .txtA insert end $x1 rm
147
+ } else {
148
+ .txtA insert end $x1 chng
149
+ .txtB insert end $x2 chng
150
+ }
143151
}
144152
}
145153
.txtA insert end \n -
146154
.txtB insert end \n -
147155
}
148156
--- src/diff.tcl
+++ src/diff.tcl
@@ -136,12 +136,20 @@
136 if {$x ne ""} {
137 .txtA insert end $x -
138 .txtB insert end $x -
139 }
140 if {$i+2<$nn} {
141 .txtA insert end [lindex $line [expr {$i+1}]] chng
142 .txtB insert end [lindex $line [expr {$i+2}]] chng
 
 
 
 
 
 
 
 
143 }
144 }
145 .txtA insert end \n -
146 .txtB insert end \n -
147 }
148
--- src/diff.tcl
+++ src/diff.tcl
@@ -136,12 +136,20 @@
136 if {$x ne ""} {
137 .txtA insert end $x -
138 .txtB insert end $x -
139 }
140 if {$i+2<$nn} {
141 set x1 [lindex $line [expr {$i+1}]]
142 set x2 [lindex $line [expr {$i+2}]]
143 if {"$x1" eq ""} {
144 .txtB insert end $x2 add
145 } elseif {"$x2" eq ""} {
146 .txtA insert end $x1 rm
147 } else {
148 .txtA insert end $x1 chng
149 .txtB insert end $x2 chng
150 }
151 }
152 }
153 .txtA insert end \n -
154 .txtB insert end \n -
155 }
156

Keyboard Shortcuts

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