@matheusbsbs / matheus-bagliano / commits / b8848f7753
Fork 0

git-gui: Allow as few as 0 lines of diff context

Johannes Sixt pointed out that dropping to 0 lines of context does allow the user to get more fine-grained hunk selection, especially since we don't currently support "highlight and apply (or revert)". Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

Shawn O. Pearce committed May 31, 2007 at 23:32 UTC b8848f7753762ff8c4e34b3c15e788c5f7e6781f
3 files changed +5 -5
git-gui.sh
+3 -3
@@ -2038,17 +2038,17 @@ lappend diff_actions [list $ctxm entryconf [$ctxm index last] -state]
2038 $ctxm add separator
2039 $ctxm add command \
2040 -label {Show Less Context} \
2041 - -command {if {$repo_config(gui.diffcontext) >= 2} {
2041 + -command {if {$repo_config(gui.diffcontext) >= 1} {
2042 incr repo_config(gui.diffcontext) -1
2043 reshow_diff
2044 }}
2045 lappend diff_actions [list $ctxm entryconf [$ctxm index last] -state]
2046 $ctxm add command \
2047 -label {Show More Context} \
2048 - -command {
2048 + -command {if {$repo_config(gui.diffcontext) < 99} {
2049 incr repo_config(gui.diffcontext)
2050 reshow_diff
2051 - }
2051 + }}
2052 lappend diff_actions [list $ctxm entryconf [$ctxm index last] -state]
2053 $ctxm add separator
2054 $ctxm add command -label {Options...} \
lib/diff.tcl
+1 -1
@@ -145,7 +145,7 @@ proc show_diff {path w {lno {}}} {
145
146 lappend cmd -p
147 lappend cmd --no-color
148 - if {$repo_config(gui.diffcontext) > 0} {
148 + if {$repo_config(gui.diffcontext) >= 0} {
149 lappend cmd "-U$repo_config(gui.diffcontext)"
150 }
151 if {$w eq $ui_index} {
lib/option.tcl
+1 -1
@@ -173,7 +173,7 @@ proc do_options {} {
173 {i-1..5 merge.verbosity {Merge Verbosity}}
174
175 {b gui.trustmtime {Trust File Modification Timestamps}}
176 - {i-1..99 gui.diffcontext {Number of Diff Context Lines}}
176 + {i-0..99 gui.diffcontext {Number of Diff Context Lines}}
177 {t gui.newbranchtemplate {New Branch Name Template}}
178 } {
179 set type [lindex $option 0]