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>
This commit is contained in:
Shawn O. Pearce 2007-05-31 23:32:54 -04:00
Родитель 905d9c9653
Коммит b8848f7753
3 изменённых файлов: 5 добавлений и 5 удалений

Просмотреть файл

@ -2038,17 +2038,17 @@ lappend diff_actions [list $ctxm entryconf [$ctxm index last] -state]
$ctxm add separator $ctxm add separator
$ctxm add command \ $ctxm add command \
-label {Show Less Context} \ -label {Show Less Context} \
-command {if {$repo_config(gui.diffcontext) >= 2} { -command {if {$repo_config(gui.diffcontext) >= 1} {
incr repo_config(gui.diffcontext) -1 incr repo_config(gui.diffcontext) -1
reshow_diff reshow_diff
}} }}
lappend diff_actions [list $ctxm entryconf [$ctxm index last] -state] lappend diff_actions [list $ctxm entryconf [$ctxm index last] -state]
$ctxm add command \ $ctxm add command \
-label {Show More Context} \ -label {Show More Context} \
-command { -command {if {$repo_config(gui.diffcontext) < 99} {
incr repo_config(gui.diffcontext) incr repo_config(gui.diffcontext)
reshow_diff reshow_diff
} }}
lappend diff_actions [list $ctxm entryconf [$ctxm index last] -state] lappend diff_actions [list $ctxm entryconf [$ctxm index last] -state]
$ctxm add separator $ctxm add separator
$ctxm add command -label {Options...} \ $ctxm add command -label {Options...} \

Просмотреть файл

@ -145,7 +145,7 @@ proc show_diff {path w {lno {}}} {
lappend cmd -p lappend cmd -p
lappend cmd --no-color lappend cmd --no-color
if {$repo_config(gui.diffcontext) > 0} { if {$repo_config(gui.diffcontext) >= 0} {
lappend cmd "-U$repo_config(gui.diffcontext)" lappend cmd "-U$repo_config(gui.diffcontext)"
} }
if {$w eq $ui_index} { if {$w eq $ui_index} {

Просмотреть файл

@ -173,7 +173,7 @@ proc do_options {} {
{i-1..5 merge.verbosity {Merge Verbosity}} {i-1..5 merge.verbosity {Merge Verbosity}}
{b gui.trustmtime {Trust File Modification Timestamps}} {b gui.trustmtime {Trust File Modification Timestamps}}
{i-1..99 gui.diffcontext {Number of Diff Context Lines}} {i-0..99 gui.diffcontext {Number of Diff Context Lines}}
{t gui.newbranchtemplate {New Branch Name Template}} {t gui.newbranchtemplate {New Branch Name Template}}
} { } {
set type [lindex $option 0] set type [lindex $option 0]