@matheusbsbs / matheus-bagliano / commits / 80dd7b4497
Fork 0

gitk: Fix changing colors through Edit->Preferences

With tcl/tk8.5 the lset command seems to behave differently. When changing the background color through Edit->Preferences, the changes are applied, but new dialogs, such as View->New view... barf with Error: unknown color name "{#ffffff}" Additionally when closing gitk, and starting it up again, a bad value has been saved to ~/.gitk, preventing gitk from running properly; it fails with Error in startup script: unknown color name "{#ffffff}" ... This commit fixes the problem by changing the color dialogs to pass the empty string {} as the list index to choosecolor. This causes the lset and lindex commands used by choosecolor to use and set the whole variable (bgcolor, fgcolor or selectbgcolor) rather than treating them as a 1-element list. Tested with tcl/tk8.4 and 8.5. Dmitry Potapov reported this problem through http://bugs.debian.org/472615 Signed-off-by: Gerrit Pape <pape@smarden.org> Signed-off-by: Paul Mackerras <paulus@samba.org>

Gerrit Pape committed Mar 26, 2008 at 18:45 UTC 80dd7b44970dee7d82fa735d2e0b828051f80545
1 file changed +3 -3
gitk
+3 -3
@@ -8045,11 +8045,11 @@ proc doprefs {} {
8045 grid $top.cdisp - -sticky w -pady 10
8046 label $top.bg -padx 40 -relief sunk -background $bgcolor
8047 button $top.bgbut -text [mc "Background"] -font optionfont \
8048 - -command [list choosecolor bgcolor 0 $top.bg background setbg]
8048 + -command [list choosecolor bgcolor {} $top.bg background setbg]
8049 grid x $top.bgbut $top.bg -sticky w
8050 label $top.fg -padx 40 -relief sunk -background $fgcolor
8051 button $top.fgbut -text [mc "Foreground"] -font optionfont \
8052 - -command [list choosecolor fgcolor 0 $top.fg foreground setfg]
8052 + -command [list choosecolor fgcolor {} $top.fg foreground setfg]
8053 grid x $top.fgbut $top.fg -sticky w
8054 label $top.diffold -padx 40 -relief sunk -background [lindex $diffcolors 0]
8055 button $top.diffoldbut -text [mc "Diff: old lines"] -font optionfont \
@@ -8069,7 +8069,7 @@ proc doprefs {} {
8069 grid x $top.hunksepbut $top.hunksep -sticky w
8070 label $top.selbgsep -padx 40 -relief sunk -background $selectbgcolor
8071 button $top.selbgbut -text [mc "Select bg"] -font optionfont \
8072 - -command [list choosecolor selectbgcolor 0 $top.selbgsep background setselbg]
8072 + -command [list choosecolor selectbgcolor {} $top.selbgsep background setselbg]
8073 grid x $top.selbgbut $top.selbgsep -sticky w
8074
8075 label $top.cfont -text [mc "Fonts: press to choose"]