From: Shawn O. Pearce Date: Sun, 12 Nov 2006 20:45:35 +0000 (-0500) Subject: git-gui: Correct bugs in font config handling. X-Git-Tag: gitgui-0.6.0~235 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=7b64d0b7d62ec0eb6e8b37f0be2e62f2a719de16;p=git.git git-gui: Correct bugs in font config handling. Apparently Tcl is being helpful on Windows during exec and is throwing a \ in front of every { it finds in the string. I'm guessing they think the value might be read by another Tcl program? Anyway, Git faithfully stores the \{ sequence and sends it back that way to Tcl, at which point Tcl parses the list wrong and starts to break it in the middle of any element which contains spaces. Therefore a list such as: -family {Times New Roman} gets broken up into the pairs: {-family \{Times} {New Roman} which is very incorrect. So now we replace all { and } with "", at which point Tcl doesn't throw \ in front of the " on the way out to Git yet it reads it correctly as a list on the way back in. I also found and fixed a bug in the way we restored the fonts when the user presses Restore Defaults in the options dialog. Signed-off-by: Shawn O. Pearce --- diff --git a/git-gui b/git-gui index 2138d2d2e..e59d225cb 100755 --- a/git-gui +++ b/git-gui @@ -91,7 +91,8 @@ proc save_config {} { if {$value == $default_config($name)} { catch {exec git repo-config --global --unset $name} } else { - catch {exec git repo-config --global $name $value} + regsub -all "\[{}\]" $value {"} value + exec git repo-config --global $name $value } set global_config($name) $value if {$value == $repo_config($name)} { @@ -107,7 +108,8 @@ proc save_config {} { if {$value == $global_config($name)} { catch {exec git repo-config --unset $name} } else { - catch {exec git repo-config $name $value} + regsub -all "\[{}\]" $value {"} value + exec git repo-config $name $value } set repo_config($name) $value } @@ -1803,7 +1805,7 @@ proc do_options {} { } proc do_restore_defaults {} { - global font_descs default_config + global font_descs default_config repo_config global repo_config_new global_config_new foreach name [array names default_config] { @@ -1813,7 +1815,7 @@ proc do_restore_defaults {} { foreach option $font_descs { set name [lindex $option 0] - set repo_config($name) $default_config(gui.$name) + set repo_config(gui.$name) $default_config(gui.$name) } apply_config