@@ -2385,6 +2385,7 @@ proc makewindow {} {
2385
2385
$ctext tag conf found -back $foundbgcolor
2386
2386
$ctext tag conf currentsearchhit -back $currentsearchhitbgcolor
2387
2387
$ctext tag conf wwrap -wrap word
2388
+ $ctext tag conf bold -font textfontbold
2388
2389
2389
2390
.pwbottom add .bleft
2390
2391
if {!$use_ttk } {
@@ -6387,6 +6388,25 @@ proc bindline {t id} {
6387
6388
$canv bind $t <Button-1> " lineclick %x %y $id 1"
6388
6389
}
6389
6390
6391
+ proc graph_pane_width {} {
6392
+ global use_ttk
6393
+
6394
+ if {$use_ttk } {
6395
+ set g [.tf.histframe.pwclist sashpos 0]
6396
+ } else {
6397
+ set g [.tf.histframe.pwclist sash coord 0]
6398
+ }
6399
+ return [lindex $g 0]
6400
+ }
6401
+
6402
+ proc totalwidth {l font extra} {
6403
+ set tot 0
6404
+ foreach str $l {
6405
+ set tot [expr {$tot + [font measure $font $str ] + $extra }]
6406
+ }
6407
+ return $tot
6408
+ }
6409
+
6390
6410
proc drawtags {id x xt y1} {
6391
6411
global idtags idheads idotherrefs mainhead
6392
6412
global linespc lthickness
@@ -6398,9 +6418,27 @@ proc drawtags {id x xt y1} {
6398
6418
set marks {}
6399
6419
set ntags 0
6400
6420
set nheads 0
6421
+ set singletag 0
6422
+ set maxtags 3
6423
+ set maxtagpct 25
6424
+ set maxwidth [expr {[graph_pane_width] * $maxtagpct / 100}]
6425
+ set delta [expr {int(0.5 * ($linespc - $lthickness ))}]
6426
+ set extra [expr {$delta + $lthickness + $linespc }]
6427
+
6401
6428
if {[info exists idtags($id )]} {
6402
6429
set marks $idtags($id)
6403
6430
set ntags [llength $marks ]
6431
+ if {$ntags > $maxtags ||
6432
+ [totalwidth $marks mainfont $extra ] > $maxwidth } {
6433
+ # show just a single "n tags..." tag
6434
+ set singletag 1
6435
+ if {$ntags == 1} {
6436
+ set marks [list " tag..." ]
6437
+ } else {
6438
+ set marks [list [format " %d tags..." $ntags ]]
6439
+ }
6440
+ set ntags 1
6441
+ }
6404
6442
}
6405
6443
if {[info exists idheads($id )]} {
6406
6444
set marks [concat $marks $idheads($id) ]
@@ -6413,7 +6451,6 @@ proc drawtags {id x xt y1} {
6413
6451
return $xt
6414
6452
}
6415
6453
6416
- set delta [expr {int(0.5 * ($linespc - $lthickness ))}]
6417
6454
set yt [expr {$y1 - 0.5 * $linespc }]
6418
6455
set yb [expr {$yt + $linespc - 1}]
6419
6456
set xvals {}
@@ -6428,7 +6465,7 @@ proc drawtags {id x xt y1} {
6428
6465
}
6429
6466
lappend xvals $xt
6430
6467
lappend wvals $wid
6431
- set xt [expr {$xt + $delta + $ wid + $lthickness + $linespc }]
6468
+ set xt [expr {$xt + $wid + $extra }]
6432
6469
}
6433
6470
set t [$canv create line $x $y1 [lindex $xvals end] $y1 \
6434
6471
-width $lthickness -fill $reflinecolor -tags tag.$id ]
@@ -6444,7 +6481,12 @@ proc drawtags {id x xt y1} {
6444
6481
$xr $yt $xr $yb $xl $yb $x [expr {$yb - $delta }] \
6445
6482
-width 1 -outline $tagoutlinecolor -fill $tagbgcolor \
6446
6483
-tags tag.$id ]
6447
- $canv bind $t <1> [list showtag $tag_quoted 1]
6484
+ if {$singletag } {
6485
+ set tagclick [list showtags $id 1]
6486
+ } else {
6487
+ set tagclick [list showtag $tag_quoted 1]
6488
+ }
6489
+ $canv bind $t <1> $tagclick
6448
6490
set rowtextx([rowofcommit $id ]) [expr {$xr + $linespc }]
6449
6491
} else {
6450
6492
# draw a head or other ref
@@ -6471,7 +6513,7 @@ proc drawtags {id x xt y1} {
6471
6513
set t [$canv create text $xl $y1 -anchor w -text $tag -fill $headfgcolor \
6472
6514
-font $font -tags [list tag.$id text]]
6473
6515
if {$ntags >= 0} {
6474
- $canv bind $t <1> [ list showtag $tag_quoted 1]
6516
+ $canv bind $t <1> $tagclick
6475
6517
} elseif {$nheads >= 0} {
6476
6518
$canv bind $t $ctxbut [list headmenu %X %Y $id $tag_quoted ]
6477
6519
}
@@ -10878,6 +10920,23 @@ proc listrefs {id} {
10878
10920
return [list $x $y $z ]
10879
10921
}
10880
10922
10923
+ proc add_tag_ctext {tag} {
10924
+ global ctext cached_tagcontent tagids
10925
+
10926
+ if {![info exists cached_tagcontent($tag )]} {
10927
+ catch {
10928
+ set cached_tagcontent($tag ) [exec git cat-file -p $tag ]
10929
+ }
10930
+ }
10931
+ $ctext insert end " [ mc " Tag" ] : $tag \n " bold
10932
+ if {[info exists cached_tagcontent($tag )]} {
10933
+ set text $cached_tagcontent($tag)
10934
+ } else {
10935
+ set text " [ mc " Id" ] : $tagids($tag) "
10936
+ }
10937
+ appendwithlinks $text {}
10938
+ }
10939
+
10881
10940
proc showtag {tag isnew} {
10882
10941
global ctext cached_tagcontent tagids linknum tagobjid
10883
10942
@@ -10888,17 +10947,28 @@ proc showtag {tag isnew} {
10888
10947
clear_ctext
10889
10948
settabs 0
10890
10949
set linknum 0
10891
- if {![info exists cached_tagcontent($tag )]} {
10892
- catch {
10893
- set cached_tagcontent($tag ) [exec git cat-file -p $tag ]
10894
- }
10950
+ add_tag_ctext $tag
10951
+ maybe_scroll_ctext 1
10952
+ $ctext conf -state disabled
10953
+ init_flist {}
10954
+ }
10955
+
10956
+ proc showtags {id isnew} {
10957
+ global idtags ctext linknum
10958
+
10959
+ if {$isnew } {
10960
+ addtohistory [list showtags $id 0] savectextpos
10895
10961
}
10896
- if {[info exists cached_tagcontent($tag )]} {
10897
- set text $cached_tagcontent($tag)
10898
- } else {
10899
- set text " [ mc " Tag" ] : $tag \n [ mc " Id" ] : $tagids($tag) "
10962
+ $ctext conf -state normal
10963
+ clear_ctext
10964
+ settabs 0
10965
+ set linknum 0
10966
+ set sep {}
10967
+ foreach tag $idtags($id) {
10968
+ $ctext insert end $sep
10969
+ add_tag_ctext $tag
10970
+ set sep " \n\n "
10900
10971
}
10901
- appendwithlinks $text {}
10902
10972
maybe_scroll_ctext 1
10903
10973
$ctext conf -state disabled
10904
10974
init_flist {}
0 commit comments