@@ -1894,6 +1894,21 @@ proc removehead {id name} {
unset headids($name)
}
+# update things when a tag has been removed
+proc removetag {id name} {
+ global tagids idtags
+
+ if {$idtags($id) eq $name} {
+ unset idtags($id)
+ } else {
+ set i [lsearch -exact $idtags($id) $name]
+ if {$i >= 0} {
+ set idtags($id) [lreplace $idtags($id) $i $i]
+ }
+ }
+ unset tagids($name)
+}
+
proc ttk_toplevel {w args} {
global use_ttk
eval [linsert $args 0 ::toplevel $w]
@@ -2096,7 +2111,7 @@ proc makewindow {} {
global uifgcolor uifgdisabledcolor
global filesepbgcolor filesepfgcolor
global mergecolors foundbgcolor currentsearchhitbgcolor
- global headctxmenu progresscanv progressitem progresscoords statusw
+ global headctxmenu tagctxmenu progresscanv progressitem progresscoords statusw
global fprogitem fprogcoord lastprogupdate progupdatepending
global rprogitem rprogcoord rownumsel numcommits
global have_tk85 use_ttk NS
@@ -2705,6 +2720,13 @@ proc makewindow {} {
}
$headctxmenu configure -tearoff 0
+ set tagctxmenu .tagctxmenu
+ makemenu $tagctxmenu {
+ {mc "Remove this tag" command rmtag}
+ {mc "Copy tag name" command {clipboard clear; clipboard append $tagmenutag}}
+ }
+ $tagctxmenu configure -tearoff 0
+
global flist_menu
set flist_menu .flistctxmenu
makemenu $flist_menu {
@@ -6701,6 +6723,7 @@ proc drawtags {id x xt y1} {
-font $font -tags [list tag.$id text]]
if {$ntags >= 0} {
$canv bind $t <1> $tagclick
+ $canv bind $t $ctxbut [list tagmenu %X %Y $id $tag_quoted]
} elseif {$nheads >= 0} {
$canv bind $t $ctxbut [list headmenu %X %Y $id $tag_quoted]
}
@@ -9938,6 +9961,20 @@ proc headmenu {x y id head} {
tk_popup $headctxmenu $x $y
}
+# context menu for a tag
+proc tagmenu {x y id head} {
+ global tagmenuid tagmenutag tagctxmenu
+
+ stopfinding
+ set tagmenuid $id
+ set tagmenutag $head
+ array set state {0 normal 1 normal}
+ foreach i {0 1} {
+ $tagctxmenu entryconfigure $i -state $state($i)
+ }
+ tk_popup $tagctxmenu $x $y
+}
+
proc cobranch {} {
global headmenuid headmenuhead headids
global showlocalchanges
@@ -10042,6 +10079,27 @@ proc rmbranch {} {
run refill_reflist
}
+proc rmtag {} {
+ global tagmenuid tagmenutag
+
+ set tag $tagmenutag
+ set id $tagmenuid
+
+ nowbusy rmtag
+ update
+ if {[catch {exec git tag -d $tag} err]} {
+ notbusy rmtag
+ error_popup $err
+ return
+ }
+ removetag $id $tag
+ removedtag $id $tag
+ redrawtags $id
+ notbusy rmtag
+ dispneartags 0
+ run refill_reflist
+}
+
# Display a list of tags and heads
proc showrefs {} {
global showrefstop bgcolor fgcolor selectbgcolor NS
@@ -11273,6 +11331,13 @@ proc removedhead {hid head} {
unset -nocomplain cached_dheads
}
+proc removedtag {hid head} {
+ global cached_dtags cached_atags
+
+ unset -nocomplain cached_dtags
+ unset -nocomplain cached_atags
+}
+
proc movedhead {hid head} {
global arcnos arcout cached_dheads