Fossil SCM
Improvements to the file selection option-menu in the merge UI.
Commit
4582d69e34f17878eb2ff1c047d0145732dc19fc786ccb6405f1cee331f20ac8
Parent
48827897cf8be8e…
1 file changed
+8
-7
+8
-7
| --- src/merge.tcl | ||
| +++ src/merge.tcl | ||
| @@ -100,11 +100,12 @@ | ||
| 100 | 100 | set cmd "$fossilcmd -c -1" |
| 101 | 101 | } else { |
| 102 | 102 | set cmd "$fossilcmd -c $ncontext" |
| 103 | 103 | } |
| 104 | 104 | if {[info exists current_file]} { |
| 105 | - append cmd " -tcl [list $current_file]" | |
| 105 | + regsub {^[A-Z]+ } $current_file {} fn | |
| 106 | + append cmd " -tcl [list $fn]" | |
| 106 | 107 | } |
| 107 | 108 | if {[catch { |
| 108 | 109 | set in [open $cmd r] |
| 109 | 110 | fconfigure $in -encoding utf-8 |
| 110 | 111 | set mergetxt [read $in] |
| @@ -227,10 +228,11 @@ | ||
| 227 | 228 | set lnWidth [string length [format %d $mx]] |
| 228 | 229 | .lnA config -width $lnWidth |
| 229 | 230 | .lnB config -width $lnWidth |
| 230 | 231 | .lnC config -width $lnWidth |
| 231 | 232 | .lnD config -width $lnWidth |
| 233 | + grid columnconfig . {0 2 4 6} -minsize $lnWidth | |
| 232 | 234 | } |
| 233 | 235 | |
| 234 | 236 | proc viewDiff {idx} { |
| 235 | 237 | .txtA yview $idx |
| 236 | 238 | .txtA xview moveto 0 |
| @@ -337,18 +339,17 @@ | ||
| 337 | 339 | } |
| 338 | 340 | |
| 339 | 341 | frame .bb |
| 340 | 342 | set useOptionMenu 1 |
| 341 | 343 | if {[info exists filelist]} { |
| 342 | - set current_file [lindex $filelist 1] | |
| 344 | + set current_file "[lindex $filelist 0] [lindex $filelist 1]" | |
| 343 | 345 | if {[llength $filelist]>2} { |
| 344 | - label .bb.filetag -text "File:" | |
| 345 | 346 | trace add variable current_file write readMerge |
| 346 | 347 | |
| 347 | 348 | if {$tcl_platform(os)=="Darwin" || [llength $filelist]<30} { |
| 348 | 349 | set fnlist {} |
| 349 | - foreach {op fn} $filelist {lappend fnlist $fn} | |
| 350 | + foreach {op fn} $filelist {lappend fnlist "$op $fn"} | |
| 350 | 351 | tk_optionMenu .bb.files current_file {*}$fnlist |
| 351 | 352 | } else { |
| 352 | 353 | set useOptionMenu 0 |
| 353 | 354 | ::ttk::menubutton .bb.files -text $current_file |
| 354 | 355 | if {[tk windowingsystem] eq "win32"} { |
| @@ -366,11 +367,11 @@ | ||
| 366 | 367 | -yscroll {.wfiles.sb set} |
| 367 | 368 | set mx 1 |
| 368 | 369 | foreach {op fn} $filelist { |
| 369 | 370 | set n [string length $fn] |
| 370 | 371 | if {$n>$mx} {set mx $n} |
| 371 | - .wfiles.lb insert end $fn | |
| 372 | + .wfiles.lb insert end "$op $fn" | |
| 372 | 373 | } |
| 373 | 374 | .bb.files config -width $mx |
| 374 | 375 | ::ttk::scrollbar .wfiles.sb -command {.wfiles.lb yview} |
| 375 | 376 | grid .wfiles.lb .wfiles.sb -sticky ns |
| 376 | 377 | bind .bb.files <1> { |
| @@ -383,11 +384,11 @@ | ||
| 383 | 384 | bind .wfiles <FocusOut> {wm withdraw .wfiles} |
| 384 | 385 | bind .wfiles <Escape> {focus .} |
| 385 | 386 | foreach evt {1 Return} { |
| 386 | 387 | bind .wfiles.lb <$evt> { |
| 387 | 388 | set ii [%W curselection] |
| 388 | - set ::current_file [lindex $::filelist [expr {$ii*2+1}]] | |
| 389 | + set ::current_file [%W get $ii] | |
| 389 | 390 | .bb.files config -text $::current_file |
| 390 | 391 | focus . |
| 391 | 392 | break |
| 392 | 393 | } |
| 393 | 394 | } |
| @@ -564,11 +565,11 @@ | ||
| 564 | 565 | } |
| 565 | 566 | ::ttk::button .bb.quit -text {Quit} -command exit |
| 566 | 567 | ::ttk::button .bb.search -text {Search} -command searchOnOff |
| 567 | 568 | pack .bb.quit -side left |
| 568 | 569 | if {[winfo exists .bb.files]} { |
| 569 | - pack .bb.filetag .bb.files -side left | |
| 570 | + pack .bb.files -side left | |
| 570 | 571 | } |
| 571 | 572 | pack .bb.ctxtag .bb.ctx -side left |
| 572 | 573 | pack .bb.search -side left |
| 573 | 574 | grid rowconfigure . 1 -weight 1 -minsize [winfo reqheight .nameA] |
| 574 | 575 | grid rowconfigure . 2 -weight 100 |
| 575 | 576 |
| --- src/merge.tcl | |
| +++ src/merge.tcl | |
| @@ -100,11 +100,12 @@ | |
| 100 | set cmd "$fossilcmd -c -1" |
| 101 | } else { |
| 102 | set cmd "$fossilcmd -c $ncontext" |
| 103 | } |
| 104 | if {[info exists current_file]} { |
| 105 | append cmd " -tcl [list $current_file]" |
| 106 | } |
| 107 | if {[catch { |
| 108 | set in [open $cmd r] |
| 109 | fconfigure $in -encoding utf-8 |
| 110 | set mergetxt [read $in] |
| @@ -227,10 +228,11 @@ | |
| 227 | set lnWidth [string length [format %d $mx]] |
| 228 | .lnA config -width $lnWidth |
| 229 | .lnB config -width $lnWidth |
| 230 | .lnC config -width $lnWidth |
| 231 | .lnD config -width $lnWidth |
| 232 | } |
| 233 | |
| 234 | proc viewDiff {idx} { |
| 235 | .txtA yview $idx |
| 236 | .txtA xview moveto 0 |
| @@ -337,18 +339,17 @@ | |
| 337 | } |
| 338 | |
| 339 | frame .bb |
| 340 | set useOptionMenu 1 |
| 341 | if {[info exists filelist]} { |
| 342 | set current_file [lindex $filelist 1] |
| 343 | if {[llength $filelist]>2} { |
| 344 | label .bb.filetag -text "File:" |
| 345 | trace add variable current_file write readMerge |
| 346 | |
| 347 | if {$tcl_platform(os)=="Darwin" || [llength $filelist]<30} { |
| 348 | set fnlist {} |
| 349 | foreach {op fn} $filelist {lappend fnlist $fn} |
| 350 | tk_optionMenu .bb.files current_file {*}$fnlist |
| 351 | } else { |
| 352 | set useOptionMenu 0 |
| 353 | ::ttk::menubutton .bb.files -text $current_file |
| 354 | if {[tk windowingsystem] eq "win32"} { |
| @@ -366,11 +367,11 @@ | |
| 366 | -yscroll {.wfiles.sb set} |
| 367 | set mx 1 |
| 368 | foreach {op fn} $filelist { |
| 369 | set n [string length $fn] |
| 370 | if {$n>$mx} {set mx $n} |
| 371 | .wfiles.lb insert end $fn |
| 372 | } |
| 373 | .bb.files config -width $mx |
| 374 | ::ttk::scrollbar .wfiles.sb -command {.wfiles.lb yview} |
| 375 | grid .wfiles.lb .wfiles.sb -sticky ns |
| 376 | bind .bb.files <1> { |
| @@ -383,11 +384,11 @@ | |
| 383 | bind .wfiles <FocusOut> {wm withdraw .wfiles} |
| 384 | bind .wfiles <Escape> {focus .} |
| 385 | foreach evt {1 Return} { |
| 386 | bind .wfiles.lb <$evt> { |
| 387 | set ii [%W curselection] |
| 388 | set ::current_file [lindex $::filelist [expr {$ii*2+1}]] |
| 389 | .bb.files config -text $::current_file |
| 390 | focus . |
| 391 | break |
| 392 | } |
| 393 | } |
| @@ -564,11 +565,11 @@ | |
| 564 | } |
| 565 | ::ttk::button .bb.quit -text {Quit} -command exit |
| 566 | ::ttk::button .bb.search -text {Search} -command searchOnOff |
| 567 | pack .bb.quit -side left |
| 568 | if {[winfo exists .bb.files]} { |
| 569 | pack .bb.filetag .bb.files -side left |
| 570 | } |
| 571 | pack .bb.ctxtag .bb.ctx -side left |
| 572 | pack .bb.search -side left |
| 573 | grid rowconfigure . 1 -weight 1 -minsize [winfo reqheight .nameA] |
| 574 | grid rowconfigure . 2 -weight 100 |
| 575 |
| --- src/merge.tcl | |
| +++ src/merge.tcl | |
| @@ -100,11 +100,12 @@ | |
| 100 | set cmd "$fossilcmd -c -1" |
| 101 | } else { |
| 102 | set cmd "$fossilcmd -c $ncontext" |
| 103 | } |
| 104 | if {[info exists current_file]} { |
| 105 | regsub {^[A-Z]+ } $current_file {} fn |
| 106 | append cmd " -tcl [list $fn]" |
| 107 | } |
| 108 | if {[catch { |
| 109 | set in [open $cmd r] |
| 110 | fconfigure $in -encoding utf-8 |
| 111 | set mergetxt [read $in] |
| @@ -227,10 +228,11 @@ | |
| 228 | set lnWidth [string length [format %d $mx]] |
| 229 | .lnA config -width $lnWidth |
| 230 | .lnB config -width $lnWidth |
| 231 | .lnC config -width $lnWidth |
| 232 | .lnD config -width $lnWidth |
| 233 | grid columnconfig . {0 2 4 6} -minsize $lnWidth |
| 234 | } |
| 235 | |
| 236 | proc viewDiff {idx} { |
| 237 | .txtA yview $idx |
| 238 | .txtA xview moveto 0 |
| @@ -337,18 +339,17 @@ | |
| 339 | } |
| 340 | |
| 341 | frame .bb |
| 342 | set useOptionMenu 1 |
| 343 | if {[info exists filelist]} { |
| 344 | set current_file "[lindex $filelist 0] [lindex $filelist 1]" |
| 345 | if {[llength $filelist]>2} { |
| 346 | trace add variable current_file write readMerge |
| 347 | |
| 348 | if {$tcl_platform(os)=="Darwin" || [llength $filelist]<30} { |
| 349 | set fnlist {} |
| 350 | foreach {op fn} $filelist {lappend fnlist "$op $fn"} |
| 351 | tk_optionMenu .bb.files current_file {*}$fnlist |
| 352 | } else { |
| 353 | set useOptionMenu 0 |
| 354 | ::ttk::menubutton .bb.files -text $current_file |
| 355 | if {[tk windowingsystem] eq "win32"} { |
| @@ -366,11 +367,11 @@ | |
| 367 | -yscroll {.wfiles.sb set} |
| 368 | set mx 1 |
| 369 | foreach {op fn} $filelist { |
| 370 | set n [string length $fn] |
| 371 | if {$n>$mx} {set mx $n} |
| 372 | .wfiles.lb insert end "$op $fn" |
| 373 | } |
| 374 | .bb.files config -width $mx |
| 375 | ::ttk::scrollbar .wfiles.sb -command {.wfiles.lb yview} |
| 376 | grid .wfiles.lb .wfiles.sb -sticky ns |
| 377 | bind .bb.files <1> { |
| @@ -383,11 +384,11 @@ | |
| 384 | bind .wfiles <FocusOut> {wm withdraw .wfiles} |
| 385 | bind .wfiles <Escape> {focus .} |
| 386 | foreach evt {1 Return} { |
| 387 | bind .wfiles.lb <$evt> { |
| 388 | set ii [%W curselection] |
| 389 | set ::current_file [%W get $ii] |
| 390 | .bb.files config -text $::current_file |
| 391 | focus . |
| 392 | break |
| 393 | } |
| 394 | } |
| @@ -564,11 +565,11 @@ | |
| 565 | } |
| 566 | ::ttk::button .bb.quit -text {Quit} -command exit |
| 567 | ::ttk::button .bb.search -text {Search} -command searchOnOff |
| 568 | pack .bb.quit -side left |
| 569 | if {[winfo exists .bb.files]} { |
| 570 | pack .bb.files -side left |
| 571 | } |
| 572 | pack .bb.ctxtag .bb.ctx -side left |
| 573 | pack .bb.search -side left |
| 574 | grid rowconfigure . 1 -weight 1 -minsize [winfo reqheight .nameA] |
| 575 | grid rowconfigure . 2 -weight 100 |
| 576 |