Fossil SCM

Fix rendering of merge information that contains "N" entries followed by "S".

drh 2024-12-04 19:25 trunk
Commit 2ec8a7ae388d06794de6a41d3b686e73dcdd726e05fd08d71cbc43a083a49656
1 file changed +44 -8
+44 -8
--- src/merge.tcl
+++ src/merge.tcl
@@ -154,53 +154,53 @@
154154
.txtA insert end [string range $A 1 end]\n $dtag
155155
}
156156
if {$key2=="."} {
157157
.lnB insert end \n -
158158
.txtB insert end \n $dtag
159
+ } elseif {$key2=="N"} {
160
+ .nameB config -text [string range $B 1 end]
159161
} else {
160162
.lnB insert end $lnB\n -
161163
incr lnB
162164
if {$key4=="2"} {set tag chng} {set tag $dtag}
163165
if {$key2=="1"} {
164166
.txtB insert end [string range $A 1 end]\n $tag
165
- } elseif {$key2=="N"} {
166
- .nameB config -text [string range $B 1 end]
167167
} else {
168168
.txtB insert end [string range $B 1 end]\n $tag
169169
}
170170
}
171171
if {$key3=="."} {
172172
.lnC insert end \n -
173173
.txtC insert end \n $dtag
174
+ } elseif {$key3=="N"} {
175
+ .nameC config -text [string range $C 1 end]
174176
} else {
175177
.lnC insert end $lnC\n -
176178
incr lnC
177179
if {$key4=="3"} {set tag add} {set tag $dtag}
178180
if {$key3=="1"} {
179181
.txtC insert end [string range $A 1 end]\n $tag
180182
} elseif {$key3=="2"} {
181183
.txtC insert end [string range $B 1 end]\n chng
182
- } elseif {$key3=="N"} {
183
- .nameC config -text [string range $C 1 end]
184
- } else {
184
+ } else {
185185
.txtC insert end [string range $C 1 end]\n $tag
186186
}
187187
}
188188
if {$key4=="." || $key4=="X"} {
189189
.lnD insert end \n -
190190
.txtD insert end \n $dtag
191
+ } elseif {$key4=="N"} {
192
+ .nameD config -text [string range $D 1 end]
191193
} else {
192194
.lnD insert end $lnD\n -
193195
incr lnD
194196
if {$key4=="1"} {
195197
.txtD insert end [string range $A 1 end]\n -
196198
} elseif {$key4=="2"} {
197199
.txtD insert end [string range $B 1 end]\n chng
198200
} elseif {$key4=="3"} {
199201
.txtD insert end [string range $C 1 end]\n add
200
- } elseif {$key4=="N"} {
201
- .nameD config -text [string range $D 1 end]
202202
} else {
203203
.txtD insert end [string range $D 1 end]\n -
204204
}
205205
}
206206
}
@@ -377,13 +377,49 @@
377377
bind .wfiles.lb <Motion> {
378378
%W selection clear 0 end
379379
%W selection set @%x,%y
380380
}
381381
}
382
+
382383
label .bb.ctxtag -text "Context:"
383
-tk_optionMenu .bb.ctx ncontext 3 6 12 25 40 100 All
384
+set context_choices {3 6 12 25 50 100 All}
385
+if {$ncontext<0} {set ncontext All}
384386
trace add variable ncontext write readMerge
387
+::ttk::menubutton .bb.ctx -text $ncontext
388
+if {[tk windowingsystem] eq "win32"} {
389
+ ::ttk::style theme use winnative
390
+ .bb.ctx configure -padding {20 1 10 2}
391
+}
392
+toplevel .wctx
393
+wm withdraw .wctx
394
+update idletasks
395
+wm transient .wctx .
396
+wm overrideredirect .wctx 1
397
+listbox .wctx.lb -width 0 -height 7 -activestyle none
398
+.wctx.lb insert end {*}$context_choices
399
+pack .wctx.lb
400
+bind .bb.ctx <1> {
401
+ set x [winfo rootx %W]
402
+ set y [expr {[winfo rooty %W]+[winfo height %W]}]
403
+ wm geometry .wctx +$x+$y
404
+ wm deiconify .wctx
405
+ focus .wctx.lb
406
+}
407
+bind .wctx <FocusOut> {wm withdraw .wctx}
408
+bind .wctx <Escape> {focus .}
409
+foreach evt {1 Return} {
410
+ bind .wctx.lb <$evt> {
411
+ set ::ncontext [lindex $::context_choices [%W curselection]]
412
+ .bb.ctx config -text $::ncontext
413
+ focus .
414
+ break
415
+ }
416
+}
417
+bind .wctx.lb <Motion> {
418
+ %W selection clear 0 end
419
+ %W selection set @%x,%y
420
+}
385421
386422
foreach {side syncCol} {A .txtB B .txtA C .txtC D .txtD} {
387423
set ln .ln$side
388424
text $ln
389425
$ln tag config - -justify right
390426
--- src/merge.tcl
+++ src/merge.tcl
@@ -154,53 +154,53 @@
154 .txtA insert end [string range $A 1 end]\n $dtag
155 }
156 if {$key2=="."} {
157 .lnB insert end \n -
158 .txtB insert end \n $dtag
 
 
159 } else {
160 .lnB insert end $lnB\n -
161 incr lnB
162 if {$key4=="2"} {set tag chng} {set tag $dtag}
163 if {$key2=="1"} {
164 .txtB insert end [string range $A 1 end]\n $tag
165 } elseif {$key2=="N"} {
166 .nameB config -text [string range $B 1 end]
167 } else {
168 .txtB insert end [string range $B 1 end]\n $tag
169 }
170 }
171 if {$key3=="."} {
172 .lnC insert end \n -
173 .txtC insert end \n $dtag
 
 
174 } else {
175 .lnC insert end $lnC\n -
176 incr lnC
177 if {$key4=="3"} {set tag add} {set tag $dtag}
178 if {$key3=="1"} {
179 .txtC insert end [string range $A 1 end]\n $tag
180 } elseif {$key3=="2"} {
181 .txtC insert end [string range $B 1 end]\n chng
182 } elseif {$key3=="N"} {
183 .nameC config -text [string range $C 1 end]
184 } else {
185 .txtC insert end [string range $C 1 end]\n $tag
186 }
187 }
188 if {$key4=="." || $key4=="X"} {
189 .lnD insert end \n -
190 .txtD insert end \n $dtag
 
 
191 } else {
192 .lnD insert end $lnD\n -
193 incr lnD
194 if {$key4=="1"} {
195 .txtD insert end [string range $A 1 end]\n -
196 } elseif {$key4=="2"} {
197 .txtD insert end [string range $B 1 end]\n chng
198 } elseif {$key4=="3"} {
199 .txtD insert end [string range $C 1 end]\n add
200 } elseif {$key4=="N"} {
201 .nameD config -text [string range $D 1 end]
202 } else {
203 .txtD insert end [string range $D 1 end]\n -
204 }
205 }
206 }
@@ -377,13 +377,49 @@
377 bind .wfiles.lb <Motion> {
378 %W selection clear 0 end
379 %W selection set @%x,%y
380 }
381 }
 
382 label .bb.ctxtag -text "Context:"
383 tk_optionMenu .bb.ctx ncontext 3 6 12 25 40 100 All
 
384 trace add variable ncontext write readMerge
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
385
386 foreach {side syncCol} {A .txtB B .txtA C .txtC D .txtD} {
387 set ln .ln$side
388 text $ln
389 $ln tag config - -justify right
390
--- src/merge.tcl
+++ src/merge.tcl
@@ -154,53 +154,53 @@
154 .txtA insert end [string range $A 1 end]\n $dtag
155 }
156 if {$key2=="."} {
157 .lnB insert end \n -
158 .txtB insert end \n $dtag
159 } elseif {$key2=="N"} {
160 .nameB config -text [string range $B 1 end]
161 } else {
162 .lnB insert end $lnB\n -
163 incr lnB
164 if {$key4=="2"} {set tag chng} {set tag $dtag}
165 if {$key2=="1"} {
166 .txtB insert end [string range $A 1 end]\n $tag
 
 
167 } else {
168 .txtB insert end [string range $B 1 end]\n $tag
169 }
170 }
171 if {$key3=="."} {
172 .lnC insert end \n -
173 .txtC insert end \n $dtag
174 } elseif {$key3=="N"} {
175 .nameC config -text [string range $C 1 end]
176 } else {
177 .lnC insert end $lnC\n -
178 incr lnC
179 if {$key4=="3"} {set tag add} {set tag $dtag}
180 if {$key3=="1"} {
181 .txtC insert end [string range $A 1 end]\n $tag
182 } elseif {$key3=="2"} {
183 .txtC insert end [string range $B 1 end]\n chng
184 } else {
 
 
185 .txtC insert end [string range $C 1 end]\n $tag
186 }
187 }
188 if {$key4=="." || $key4=="X"} {
189 .lnD insert end \n -
190 .txtD insert end \n $dtag
191 } elseif {$key4=="N"} {
192 .nameD config -text [string range $D 1 end]
193 } else {
194 .lnD insert end $lnD\n -
195 incr lnD
196 if {$key4=="1"} {
197 .txtD insert end [string range $A 1 end]\n -
198 } elseif {$key4=="2"} {
199 .txtD insert end [string range $B 1 end]\n chng
200 } elseif {$key4=="3"} {
201 .txtD insert end [string range $C 1 end]\n add
 
 
202 } else {
203 .txtD insert end [string range $D 1 end]\n -
204 }
205 }
206 }
@@ -377,13 +377,49 @@
377 bind .wfiles.lb <Motion> {
378 %W selection clear 0 end
379 %W selection set @%x,%y
380 }
381 }
382
383 label .bb.ctxtag -text "Context:"
384 set context_choices {3 6 12 25 50 100 All}
385 if {$ncontext<0} {set ncontext All}
386 trace add variable ncontext write readMerge
387 ::ttk::menubutton .bb.ctx -text $ncontext
388 if {[tk windowingsystem] eq "win32"} {
389 ::ttk::style theme use winnative
390 .bb.ctx configure -padding {20 1 10 2}
391 }
392 toplevel .wctx
393 wm withdraw .wctx
394 update idletasks
395 wm transient .wctx .
396 wm overrideredirect .wctx 1
397 listbox .wctx.lb -width 0 -height 7 -activestyle none
398 .wctx.lb insert end {*}$context_choices
399 pack .wctx.lb
400 bind .bb.ctx <1> {
401 set x [winfo rootx %W]
402 set y [expr {[winfo rooty %W]+[winfo height %W]}]
403 wm geometry .wctx +$x+$y
404 wm deiconify .wctx
405 focus .wctx.lb
406 }
407 bind .wctx <FocusOut> {wm withdraw .wctx}
408 bind .wctx <Escape> {focus .}
409 foreach evt {1 Return} {
410 bind .wctx.lb <$evt> {
411 set ::ncontext [lindex $::context_choices [%W curselection]]
412 .bb.ctx config -text $::ncontext
413 focus .
414 break
415 }
416 }
417 bind .wctx.lb <Motion> {
418 %W selection clear 0 end
419 %W selection set @%x,%y
420 }
421
422 foreach {side syncCol} {A .txtB B .txtA C .txtC D .txtD} {
423 set ln .ln$side
424 text $ln
425 $ln tag config - -justify right
426

Keyboard Shortcuts

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