summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: fd2656f)
raw | patch | inline | side by side (parent: fd2656f)
author | Shawn O. Pearce <spearce@spearce.org> | |
Mon, 13 Nov 2006 00:20:02 +0000 (19:20 -0500) | ||
committer | Shawn O. Pearce <spearce@spearce.org> | |
Mon, 13 Nov 2006 05:10:39 +0000 (00:10 -0500) |
When displaying a diff the Git default of 3 line of context may not be
enough for a user to see what has actually changed. Consequently we
set our own program default to 5 lines of context and then allow the
user to adjust this on a per-repository and global level through our
options dialog.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
enough for a user to see what has actually changed. Consequently we
set our own program default to 5 lines of context and then allow the
user to adjust this on a per-repository and global level through our
options dialog.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
git-gui | patch | blob | history |
index ea71526e6065bbade5b97a8a0ff38cca467518ec..3f74fbb0764edf0260e292ec26cc8d6fb482edd0 100755 (executable)
--- a/git-gui
+++ b/git-gui
set cmd [list | git diff-index]
lappend cmd --no-color
+ if {$repo_config(gui.diffcontext) > 0} {
+ lappend cmd "-U$repo_config(gui.diffcontext)"
+ }
lappend cmd -p
switch $m {
global repo_config global_config
global repo_config_new global_config_new
- load_config 1
array unset repo_config_new
array unset global_config_new
foreach name [array names repo_config] {
set repo_config_new($name) $repo_config($name)
}
+ load_config 1
+ foreach name [array names repo_config] {
+ switch -- $name {
+ gui.diffcontext {continue}
+ }
+ set repo_config_new($name) $repo_config($name)
+ }
foreach name [array names global_config] {
set global_config_new($name) $global_config($name)
}
pack $w.global -side right -fill both -expand 1 -pady 5 -padx 5
foreach option {
- {pullsummary {Show Pull Summary}}
- {trustmtime {Trust File Modification Timestamps}}
+ {b pullsummary {Show Pull Summary}}
+ {b trustmtime {Trust File Modification Timestamps}}
+ {i diffcontext {Number of Diff Context Lines}}
} {
- set name [lindex $option 0]
- set text [lindex $option 1]
+ set type [lindex $option 0]
+ set name [lindex $option 1]
+ set text [lindex $option 2]
foreach f {repo global} {
- checkbutton $w.$f.$name -text $text \
- -variable ${f}_config_new(gui.$name) \
- -onvalue true \
- -offvalue false \
- -font font_ui
- pack $w.$f.$name -side top -anchor w
+ switch $type {
+ b {
+ checkbutton $w.$f.$name -text $text \
+ -variable ${f}_config_new(gui.$name) \
+ -onvalue true \
+ -offvalue false \
+ -font font_ui
+ pack $w.$f.$name -side top -anchor w
+ }
+ i {
+ frame $w.$f.$name
+ label $w.$f.$name.l -text "$text:" -font font_ui
+ pack $w.$f.$name.l -side left -anchor w -fill x
+ spinbox $w.$f.$name.v \
+ -textvariable ${f}_config_new(gui.$name) \
+ -from 1 -to 99 -increment 1 \
+ -width 3 \
+ -font font_ui
+ pack $w.$f.$name.v -side right -anchor e
+ pack $w.$f.$name -side top -anchor w -fill x
+ }
+ }
}
}
if {[catch {save_config} err]} {
error_popup "Failed to completely save options:\n\n$err"
}
+ reshow_diff
destroy $w
}
set default_config(gui.trustmtime) false
set default_config(gui.pullsummary) true
+set default_config(gui.diffcontext) 5
set default_config(gui.fontui) [font configure font_ui]
set default_config(gui.fontdiff) [font configure font_diff]
set font_descs {
$ui_diff.ctxm add command -label "Increase Font Size" \
-font font_ui \
-command {incr_font_size font_diff 1}
+$ui_diff.ctxm add separator
+$ui_diff.ctxm add command -label "Show Less Context" \
+ -font font_ui \
+ -command {if {$ui_fname_value ne {}
+ && $repo_config(gui.diffcontext) >= 2} {
+ incr repo_config(gui.diffcontext) -1
+ reshow_diff
+ }}
+$ui_diff.ctxm add command -label "Show More Context" \
+ -font font_ui \
+ -command {if {$ui_fname_value ne {}} {
+ incr repo_config(gui.diffcontext)
+ reshow_diff
+ }}
+$ui_diff.ctxm add separator
$ui_diff.ctxm add command -label {Options...} \
-font font_ui \
-command do_options