git-gui: Allow the user to change the diff viewer font size.
Because the diff area is one of the most important areas to be able to read users should be able to increase or decrease the size of the font used within that area. Currently we save that back to the global configuration, even if it may have originated from the local repository configuration. This is probably going to be considered to be a bug by at least one user who wants some sort of different font within a given repository, but I'm just going to ignore the problem for now. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Shawn O. Pearce committed
Nov 11, 2006 at 21:14 UTC
2c26e6f5279286aa844a54363d877acffb4a4310
1 file changed
+27
-1
git-gui
+27
-1
@@ -39,6 +39,7 @@ proc load_repo_config {} {
39
proc save_my_config {} {
40
global repo_config
41
global cfg_trust_mtime
42
+ global font_diff
43
44
if {[catch {set rc_trustMTime $repo_config(gui.trustmtime)}]} {
45
set rc_trustMTime [list false]
@@ -48,6 +49,14 @@ proc save_my_config {} {
49
set repo_config(gui.trustmtime) [list $cfg_trust_mtime]
50
}
51
52
+ if {[catch {set rc_fontdiff $repo_config(gui.fontdiff)}]} {
53
+ set rc_fontdiff [list {Courier 10}]
54
+ }
55
+ if {$font_diff != [lindex $rc_fontdiff 0]} {
56
+ exec git repo-config --global gui.fontDiff $font_diff
57
+ set repo_config(gui.fontdiff) [list $font_diff]
58
+ }
59
+
60
set cfg_geometry [wm geometry .]
61
append cfg_geometry " [lindex [.vpane sash coord 0] 1]"
62
append cfg_geometry " [lindex [.vpane.files sash coord 0] 0]"
@@ -1890,9 +1899,9 @@ pack .vpane.lower.diff.body -side bottom -fill both -expand 1
1899
1900
$ui_diff tag conf dm -foreground red
1901
$ui_diff tag conf dp -foreground blue
1893
-$ui_diff tag conf da -font [concat $font_diff bold]
1902
$ui_diff tag conf di -foreground "#00a000"
1903
$ui_diff tag conf dni -foreground "#a000a0"
1904
+$ui_diff tag conf da -font [concat $font_diff bold]
1905
$ui_diff tag conf bold -font [concat $font_diff bold]
1906
1907
# -- Diff Body Context Menu
@@ -1911,6 +1920,23 @@ $ui_diff.ctxm add command -label "Copy All" \
1920
tk_textCopy $ui_diff
1921
$ui_diff tag remove sel 0.0 end
1922
"
1923
+$ui_diff.ctxm add separator
1924
+$ui_diff.ctxm add command -label "Decrease Font Size" \
1925
+ -font $font_ui \
1926
+ -command {
1927
+ lset font_diff 1 [expr [lindex $font_diff 1] - 1]
1928
+ $ui_diff configure -font $font_diff
1929
+ $ui_diff tag conf da -font [concat $font_diff bold]
1930
+ $ui_diff tag conf bold -font [concat $font_diff bold]
1931
+ }
1932
+$ui_diff.ctxm add command -label "Increase Font Size" \
1933
+ -font $font_ui \
1934
+ -command {
1935
+ lset font_diff 1 [expr [lindex $font_diff 1] + 1]
1936
+ $ui_diff configure -font $font_diff
1937
+ $ui_diff tag conf da -font [concat $font_diff bold]
1938
+ $ui_diff tag conf bold -font [concat $font_diff bold]
1939
+ }
1940
bind $ui_diff <Any-Button-3> "tk_popup $ui_diff.ctxm %X %Y"
1941
1942
# -- Status Bar