︙ | | |
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
-
+
|
# Add a dummy if it does not exist.
proc addBalloon {args} {}
} else {
namespace import -force psballoon::addBalloon
}
set debug 0
set diffver "Version 2.0.3+ 2004-05-26"
set diffver "Version 2.0.3+ 2004-06-16"
set thisScript [file join [pwd] [info script]]
set thisDir [file dirname $thisScript]
# Follow any link
set tmplink $thisScript
while {[file type $tmplink] eq "link"} {
set tmplink [file readlink $tmplink]
|
︙ | | |
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
|
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
for {set t 0} {$t < $d} {incr t} {
$w insert end \n
}
}
close $ch1
close $ch2
# Mark aligned lines
if {[info exists ::diff($top,aligns)] && \
[llength $::diff($top,aligns)] > 0} {
foreach {align1 align2} $::diff($top,aligns) {
set i [$::widgets($top,wLine1) search -regexp "\\m$align1\\M" 1.0]
if {$i != ""} {
$::widgets($top,wLine1) tag add align \
"$i linestart" "$i lineend"
}
set i [$::widgets($top,wLine2) search -regexp "\\m$align2\\M" 1.0]
if {$i != ""} {
$::widgets($top,wLine2) tag add align \
"$i linestart" "$i lineend"
}
}
}
drawMap $top -1
foreach item {wLine1 wLine2} {
set w $::widgets($top,$item)
$w configure -state disabled
}
update idletasks
|
︙ | | |
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
|
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
|
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
eval $::widgets($top,enableAlignCmd)
}
proc disableAlign {top} {
eval $::widgets($top,disableAlignCmd)
}
# Remove one or all alignment pairs
proc clearAlign {top} {
set ::diff($top,aligns) {}
disableAlign $top
proc clearAlign {top {leftline {}}} {
if {$leftline == ""} {
set ::diff($top,aligns) {}
} else {
set i 0
while 1 {
set i [lsearch -integer -start $i $::diff($top,aligns) $leftline]
if {$i < 0} break
if {($i % 2) == 0} {
set ::diff($top,aligns) [lreplace $::diff($top,aligns) \
$i [expr {$i + 1}]]
break
}
incr i
}
}
if {[llength $::diff($top,aligns)] == 0} {
disableAlign $top
}
}
# Mark a line as aligned.
proc markAlign {top n line text} {
set ::diff($top,align$n) $line
set ::diff($top,aligntext$n) $text
|
︙ | | |
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
|
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
|
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
|
set data [$w get $row.0 $row.end]
if {![regexp {\d+} $data line]} {
return 1
}
set text [$::widgets($top,wDiff$n) get $row.0 $row.end]
set other [expr {$n == 1 ? 2 : 1}]
set cmd [list markAlign $top $n $line $text]
if {![info exists ::diff($top,align$other)]} {
set label "Mark line for alignment"
} else {
set label "Align with line $::diff($top,align$other) on other side"
}
if {[info exists ::diff($top,aligns)]} {
foreach {align1 align2} $::diff($top,aligns) {
if {$n == 1 && $line == $align1} {
set label "Remove alignment with line $align2"
set cmd [list clearAlign $top $align1]
} elseif {$n == 2 && $line == $align2} {
set label "Remove alignment with line $align1"
set cmd [list clearAlign $top $align1]
}
}
}
.lpm add command -label $label -command [list markAlign $top $n $line $text]
.lpm add command -label $label -command $cmd
return 0
}
###################
# Diff highlighting
###################
|
︙ | | |
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
|
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
|
+
+
|
set ::diff($top,nopopup) 1
tk_popup .lpm $X $Y
after idle [list after 1 [list set ::diff($top,nopopup) 0]]
return
}
# This is called when right clicking over the line numbers which are not
# marked for changes
proc rowPopup {w X Y x y} {
set top [winfo toplevel $w]
if {[info exists ::diff($top,nopopup)] && $::diff($top,nopopup)} return
destroy .lpm
menu .lpm
regexp {(\d+)\D*$} $w -> n
|
︙ | | |
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
|
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
|
-
-
+
+
-
+
|
label $top.ls -width 1 -pady 0 -padx 0 \
-textvariable ::widgets($top,isearchLabel)
addBalloon $top.ls "Incremental search indicator"
canvas $top.c -width 6 -bd 0 -selectborderwidth 0 -highlightthickness 0
applyColor
$top.ft1.tt tag configure last -underline 1
$top.ft2.tt tag configure last -underline 1
foreach w [list $top.ft1.tt $top.ft2.tt] {
$w tag configure last -underline 1
foreach w [list $top.ft1.tt $top.ft2.tt] {
$w tag raise sel
bind $w <ButtonPress-3> "zoomRow %W %X %Y %x %y"
bind $w <ButtonRelease-3> "unzoomRow %W"
}
foreach w [list $top.ft1.tl $top.ft2.tl] {
$w tag configure align -underline 1
bind $w <ButtonPress-3> "rowPopup %W %X %Y %x %y"
}
grid $top.l1 $top.le - $top.l2 -row 1 -sticky news
grid $top.ft1 $top.c $top.sby $top.ft2 -row 2 -sticky news
grid $top.sbx1 $top.ls - $top.sbx2 -row 3 -sticky news
grid columnconfigure $top {0 3} -weight 1
|
︙ | | |
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
|
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
|
-
+
-
+
|
set ch [open $file r]
set data [read $ch]
close $ch
set tags {}
while {$data != ""} {
if {[regexp {^([^<]*)<(/?)([^>]+)>(.*)$} $data -> pre sl tag post]} {
$w insert end $pre $tags
$w insert end [subst -nocommands -novariables $pre] $tags
set i [lsearch $tags $tag]
if {$sl != ""} {
# Remove tag
if {$i >= 0} {
set tags [lreplace $tags $i $i]
}
} else {
# Add tag
lappend tags $tag
}
set data $post
} else {
$w insert end $data $tags
$w insert end [subst -nocommands -novariables $data] $tags
set data ""
}
}
}
proc makeHelpWin {} {
global Pref
|
︙ | | |
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
|
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
|
+
|
set relief [$w.t cget -relief]
$w configure -relief $relief -borderwidth $bw
$w.t configure -borderwidth 0
# Set up tags
$w.t tag configure ul -underline 1
$w.t tag configure b -font tutFontB
$w.t tag configure bullet -tabs "1c" -lmargin2 "1c"
insertTaggedText $w.t $doc
$w.t configure -state disabled
}
proc printUsage {} {
puts {Usage: eskil.tcl [options] [file1] [file2]
|
︙ | | |