[PATCH] gitk: Add checkbutton to ignore space changes
Ignoring space changes can be helpful. For example, a commit claims to only reformat source code and you quickly want to verify if this claim is true. Or a commit accidentally changes code formatting and you want to focus on the real changes. In such cases a button to toggle of whitespace changes would be quite handy. You could quickly toggle between seeing and ignoring whitespace changes. This commit adds such a checkbutton right above the diff view. However, in general it is a good thing to see whitespace changes and therefore the state of the checkbutton is not saved. For example, space changes might happen unintentionally. But they are real changes yielding different sha1s for the blobs involved. Signed-off-by: Steffen Prohaska <prohaska@zib.de> Signed-off-by: Paul Mackerras <paulus@samba.org>maint
parent
3d2c998e30
commit
b9b86007e2
13
gitk
13
gitk
|
@ -632,6 +632,7 @@ proc makewindow {} {
|
||||||
global findtype findtypemenu findloc findstring fstring geometry
|
global findtype findtypemenu findloc findstring fstring geometry
|
||||||
global entries sha1entry sha1string sha1but
|
global entries sha1entry sha1string sha1but
|
||||||
global diffcontextstring diffcontext
|
global diffcontextstring diffcontext
|
||||||
|
global ignorespace
|
||||||
global maincursor textcursor curtextcursor
|
global maincursor textcursor curtextcursor
|
||||||
global rowctxmenu fakerowmenu mergemax wrapcomment
|
global rowctxmenu fakerowmenu mergemax wrapcomment
|
||||||
global highlight_files gdttype
|
global highlight_files gdttype
|
||||||
|
@ -849,6 +850,9 @@ proc makewindow {} {
|
||||||
trace add variable diffcontextstring write diffcontextchange
|
trace add variable diffcontextstring write diffcontextchange
|
||||||
lappend entries .bleft.mid.diffcontext
|
lappend entries .bleft.mid.diffcontext
|
||||||
pack .bleft.mid.labeldiffcontext .bleft.mid.diffcontext -side left
|
pack .bleft.mid.labeldiffcontext .bleft.mid.diffcontext -side left
|
||||||
|
checkbutton .bleft.mid.ignspace -text [mc "Ignore space change"] \
|
||||||
|
-command changeignorespace -variable ignorespace
|
||||||
|
pack .bleft.mid.ignspace -side left -padx 5
|
||||||
set ctext .bleft.ctext
|
set ctext .bleft.ctext
|
||||||
text $ctext -background $bgcolor -foreground $fgcolor \
|
text $ctext -background $bgcolor -foreground $fgcolor \
|
||||||
-state disabled -font textfont \
|
-state disabled -font textfont \
|
||||||
|
@ -5270,13 +5274,21 @@ proc diffcontextchange {n1 n2 op} {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
proc changeignorespace {} {
|
||||||
|
reselectline
|
||||||
|
}
|
||||||
|
|
||||||
proc getblobdiffs {ids} {
|
proc getblobdiffs {ids} {
|
||||||
global blobdifffd diffids env
|
global blobdifffd diffids env
|
||||||
global diffinhdr treediffs
|
global diffinhdr treediffs
|
||||||
global diffcontext
|
global diffcontext
|
||||||
|
global ignorespace
|
||||||
global limitdiffs viewfiles curview
|
global limitdiffs viewfiles curview
|
||||||
|
|
||||||
set cmd [diffcmd $ids "-p -C --no-commit-id -U$diffcontext"]
|
set cmd [diffcmd $ids "-p -C --no-commit-id -U$diffcontext"]
|
||||||
|
if {$ignorespace} {
|
||||||
|
append cmd " -w"
|
||||||
|
}
|
||||||
if {$limitdiffs && $viewfiles($curview) ne {}} {
|
if {$limitdiffs && $viewfiles($curview) ne {}} {
|
||||||
set cmd [concat $cmd -- $viewfiles($curview)]
|
set cmd [concat $cmd -- $viewfiles($curview)]
|
||||||
}
|
}
|
||||||
|
@ -8459,6 +8471,7 @@ set bgcolor white
|
||||||
set fgcolor black
|
set fgcolor black
|
||||||
set diffcolors {red "#00a000" blue}
|
set diffcolors {red "#00a000" blue}
|
||||||
set diffcontext 3
|
set diffcontext 3
|
||||||
|
set ignorespace 0
|
||||||
set selectbgcolor gray85
|
set selectbgcolor gray85
|
||||||
|
|
||||||
## For msgcat loading, first locate the installation location.
|
## For msgcat loading, first locate the installation location.
|
||||||
|
|
Loading…
Reference in New Issue