Skip to content

Commit 3cd204e

Browse files
committed
gitk: Fix enabling/disabling of menu items on Mac OS X
It seems that under Mac OS X, the menus get some extra entries (or possibly fewer entries), leading to references to entries by an absolute number being off. This leads to an error when invoking gitk --all under Mac OS X, because the "Edit view" and "Delete view" entries aren't were gitk expects them, and so enabling them gives an error. This changes the code so it refers to menu entries by their content, which should solve the problem. Signed-off-by: Paul Mackerras <[email protected]>
1 parent 67c2287 commit 3cd204e

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

gitk

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,7 @@ proc makewindow {} {
554554
pack .ctop.top.lbar.vlabel -side left -fill y
555555
global viewhlmenu selectedhlview
556556
set viewhlmenu [tk_optionMenu .ctop.top.lbar.vhl selectedhlview None]
557-
$viewhlmenu entryconf 0 -command delvhighlight
557+
$viewhlmenu entryconf None -command delvhighlight
558558
$viewhlmenu conf -font $uifont
559559
.ctop.top.lbar.vhl conf -font $uifont
560560
pack .ctop.top.lbar.vhl -side left -fill y
@@ -1474,7 +1474,7 @@ proc doviewmenu {m first cmd op argv} {
14741474
proc allviewmenus {n op args} {
14751475
global viewhlmenu
14761476

1477-
doviewmenu .bar.view 7 [list showview $n] $op $args
1477+
doviewmenu .bar.view 5 [list showview $n] $op $args
14781478
doviewmenu $viewhlmenu 1 [list addvhighlight $n] $op $args
14791479
}
14801480

@@ -1516,7 +1516,7 @@ proc newviewok {top n} {
15161516
set viewperm($n) $newviewperm($n)
15171517
if {$newviewname($n) ne $viewname($n)} {
15181518
set viewname($n) $newviewname($n)
1519-
doviewmenu .bar.view 7 [list showview $n] \
1519+
doviewmenu .bar.view 5 [list showview $n] \
15201520
entryconf [list -label $viewname($n)]
15211521
doviewmenu $viewhlmenu 1 [list addvhighlight $n] \
15221522
entryconf [list -label $viewname($n) -value $viewname($n)]
@@ -1632,8 +1632,8 @@ proc showview {n} {
16321632

16331633
set curview $n
16341634
set selectedview $n
1635-
.bar.view entryconf 2 -state [expr {$n == 0? "disabled": "normal"}]
1636-
.bar.view entryconf 3 -state [expr {$n == 0? "disabled": "normal"}]
1635+
.bar.view entryconf Edit* -state [expr {$n == 0? "disabled": "normal"}]
1636+
.bar.view entryconf Delete* -state [expr {$n == 0? "disabled": "normal"}]
16371637

16381638
if {![info exists viewdata($n)]} {
16391639
set pending_select $selid
@@ -4899,9 +4899,9 @@ proc rowmenu {x y id} {
48994899
} else {
49004900
set state normal
49014901
}
4902-
$rowctxmenu entryconfigure 0 -state $state
4903-
$rowctxmenu entryconfigure 1 -state $state
4904-
$rowctxmenu entryconfigure 2 -state $state
4902+
$rowctxmenu entryconfigure "Diff this*" -state $state
4903+
$rowctxmenu entryconfigure "Diff selected*" -state $state
4904+
$rowctxmenu entryconfigure "Make patch" -state $state
49054905
set rowmenuid $id
49064906
tk_popup $rowctxmenu $x $y
49074907
}
@@ -6305,8 +6305,8 @@ if {$cmdline_files ne {} || $revtreeargs ne {}} {
63056305
set viewargs(1) $revtreeargs
63066306
set viewperm(1) 0
63076307
addviewmenu 1
6308-
.bar.view entryconf 2 -state normal
6309-
.bar.view entryconf 3 -state normal
6308+
.bar.view entryconf Edit* -state normal
6309+
.bar.view entryconf Delete* -state normal
63106310
}
63116311

63126312
if {[info exists permviews]} {

0 commit comments

Comments
 (0)