{"thread":{"id":"11661","subject":"[PATCH] gitk: Add checkbutton to ignore space changes","startedAt":"2008-01-17T22:42:55Z","lastAt":"2008-01-17T22:42:55Z","messageCount":1,"participants":["Steffen Prohaska"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"65793","messageId":"12006097753995-git-send-email-prohaska@zib.de","threadId":"11661","inReplyTo":null,"subject":"[PATCH] gitk: Add checkbutton to ignore space changes","fromName":"Steffen Prohaska","fromEmail":"prohaska@zib.de","sentAt":"2008-01-17T22:42:55Z","receivedAt":"2008-01-17T22:42:55Z","isPatch":true,"sender":{"key":"prohaska@zib.de","avatar":"https://avatars.githubusercontent.com/u/217580?v=4"},"body":"Ignoring space changes can be helpful.  For example, a commit\nclaims to only reformat source code and you quickly want to\nverify if this claim is true.  Or a commit accidentally changes\ncode formatting and you want to focus on the real changes.\n\nIn such cases a button to toggle of whitespace changes would be\nquite handy.  You could quickly toggle between seeing and\nignoring whitespace changes.\n\nThis commit adds such a checkbutton right above the diff view.\n\nHowever, in general it is a good thing to see whitespace changes\nand therefore the state of the checkbutton is not saved. For\nexample, space changes might happen unintentionally.  But they are\nreal changes yielding different sha1s for the blobs involved.\n\nSigned-off-by: Steffen Prohaska <prohaska@zib.de>\n---\n gitk-git/gitk |   13 +++++++++++++\n 1 files changed, 13 insertions(+), 0 deletions(-)\n\ndiff --git a/gitk-git/gitk b/gitk-git/gitk\nindex b3cb8e8..6eadbde 100644\n--- a/gitk-git/gitk\n+++ b/gitk-git/gitk\n@@ -632,6 +632,7 @@ proc makewindow {} {\n     global findtype findtypemenu findloc findstring fstring geometry\n     global entries sha1entry sha1string sha1but\n     global diffcontextstring diffcontext\n+    global ignorespace\n     global maincursor textcursor curtextcursor\n     global rowctxmenu fakerowmenu mergemax wrapcomment\n     global highlight_files gdttype\n@@ -849,6 +850,9 @@ proc makewindow {} {\n     trace add variable diffcontextstring write diffcontextchange\n     lappend entries .bleft.mid.diffcontext\n     pack .bleft.mid.labeldiffcontext .bleft.mid.diffcontext -side left\n+    checkbutton .bleft.mid.ignspace -text [mc \"Ignore space change\"] \\\n+\t-command changeignorespace -variable ignorespace\n+    pack .bleft.mid.ignspace -side left -padx 5\n     set ctext .bleft.ctext\n     text $ctext -background $bgcolor -foreground $fgcolor \\\n \t-state disabled -font textfont \\\n@@ -5269,13 +5273,21 @@ proc diffcontextchange {n1 n2 op} {\n     }\n }\n \n+proc changeignorespace {} {\n+    reselectline\n+}\n+\n proc getblobdiffs {ids} {\n     global blobdifffd diffids env\n     global diffinhdr treediffs\n     global diffcontext\n+    global ignorespace\n     global limitdiffs viewfiles curview\n \n     set cmd [diffcmd $ids \"-p -C --no-commit-id -U$diffcontext\"]\n+    if {$ignorespace} {\n+\tappend cmd \" -w\"\n+    }\n     if {$limitdiffs && $viewfiles($curview) ne {}} {\n \tset cmd [concat $cmd -- $viewfiles($curview)]\n     }\n@@ -8458,6 +8470,7 @@ set bgcolor white\n set fgcolor black\n set diffcolors {red \"#00a000\" blue}\n set diffcontext 3\n+set ignorespace 0\n set selectbgcolor gray85\n \n ## For msgcat loading, first locate the installation location.\n-- \n1.5.4.rc2.60.g46ee\n"}]}