提交 7b64d0b7 编写于 作者: S Shawn O. Pearce

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: NShawn O. Pearce <spearce@spearce.org>
上级 4af2c384
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册