summaryrefslogtreecommitdiff
path: root/git-gui
diff options
context:
space:
mode:
authorLibravatar Shawn O. Pearce <spearce@spearce.org>2006-11-11 21:14:28 -0500
committerLibravatar Shawn O. Pearce <spearce@spearce.org>2006-11-12 00:16:04 -0500
commit2c26e6f5279286aa844a54363d877acffb4a4310 (patch)
treef29515a40086eda3a9671d1dd52d947ec1db2b64 /git-gui
parentgit-gui: Honor system font and let user configure fonts. (diff)
downloadtgif-2c26e6f5279286aa844a54363d877acffb4a4310.tar.xz
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>
Diffstat (limited to 'git-gui')
-rwxr-xr-xgit-gui28
1 files changed, 27 insertions, 1 deletions
diff --git a/git-gui b/git-gui
index 26df169c18..fdb1dce88d 100755
--- a/git-gui
+++ b/git-gui
@@ -39,6 +39,7 @@ proc load_repo_config {} {
proc save_my_config {} {
global repo_config
global cfg_trust_mtime
+ global font_diff
if {[catch {set rc_trustMTime $repo_config(gui.trustmtime)}]} {
set rc_trustMTime [list false]
@@ -48,6 +49,14 @@ proc save_my_config {} {
set repo_config(gui.trustmtime) [list $cfg_trust_mtime]
}
+ if {[catch {set rc_fontdiff $repo_config(gui.fontdiff)}]} {
+ set rc_fontdiff [list {Courier 10}]
+ }
+ if {$font_diff != [lindex $rc_fontdiff 0]} {
+ exec git repo-config --global gui.fontDiff $font_diff
+ set repo_config(gui.fontdiff) [list $font_diff]
+ }
+
set cfg_geometry [wm geometry .]
append cfg_geometry " [lindex [.vpane sash coord 0] 1]"
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
$ui_diff tag conf dm -foreground red
$ui_diff tag conf dp -foreground blue
-$ui_diff tag conf da -font [concat $font_diff bold]
$ui_diff tag conf di -foreground "#00a000"
$ui_diff tag conf dni -foreground "#a000a0"
+$ui_diff tag conf da -font [concat $font_diff bold]
$ui_diff tag conf bold -font [concat $font_diff bold]
# -- Diff Body Context Menu
@@ -1911,6 +1920,23 @@ $ui_diff.ctxm add command -label "Copy All" \
tk_textCopy $ui_diff
$ui_diff tag remove sel 0.0 end
"
+$ui_diff.ctxm add separator
+$ui_diff.ctxm add command -label "Decrease Font Size" \
+ -font $font_ui \
+ -command {
+ lset font_diff 1 [expr [lindex $font_diff 1] - 1]
+ $ui_diff configure -font $font_diff
+ $ui_diff tag conf da -font [concat $font_diff bold]
+ $ui_diff tag conf bold -font [concat $font_diff bold]
+ }
+$ui_diff.ctxm add command -label "Increase Font Size" \
+ -font $font_ui \
+ -command {
+ lset font_diff 1 [expr [lindex $font_diff 1] + 1]
+ $ui_diff configure -font $font_diff
+ $ui_diff tag conf da -font [concat $font_diff bold]
+ $ui_diff tag conf bold -font [concat $font_diff bold]
+ }
bind $ui_diff <Any-Button-3> "tk_popup $ui_diff.ctxm %X %Y"
# -- Status Bar