From: Steffen Prohaska <prohaska@zib.de>
To: git@vger.kernel.org, paulus@samba.org
Cc: Steffen Prohaska <prohaska@zib.de>
Subject: [PATCH] gitk: let you easily specify lines of context in diff view
Date: Thu, 26 Jul 2007 09:59:29 +0200 [thread overview]
Message-ID: <11854367692095-git-send-email-prohaska@zib.de> (raw)
More lines of context sometimes help to better understand a diff.
This patch introduces a text field above the box displaying the
blobdiffs. You can type in the number of lines of context that
you wish to view.
Minor improvements are needed:
* The value you type in is only used on the next update.
* lines of context is initially always 3.
Signed-off-by: Steffen Prohaska <prohaska@zib.de>
---
gitk | 25 +++++++++++++++++++++++--
1 files changed, 23 insertions(+), 2 deletions(-)
The patch may need some polishing. I know some tcl but this is the
first time I tried tk:
* I initialized diffcontext globally, ok?
* I don't know how to update the view after entering a new value.
Steffen
diff --git a/gitk b/gitk
index 39e452a..4e9acff 100755
--- a/gitk
+++ b/gitk
@@ -500,6 +500,7 @@ proc makewindow {} {
global textfont mainfont uifont tabstop
global findtype findtypemenu findloc findstring fstring geometry
global entries sha1entry sha1string sha1but
+ global diffcontextstring
global maincursor textcursor curtextcursor
global rowctxmenu fakerowmenu mergemax wrapcomment
global highlight_files gdttype
@@ -714,7 +715,12 @@ proc makewindow {} {
-command changediffdisp -variable diffelide -value {0 1}
radiobutton .bleft.mid.new -text "New version" \
-command changediffdisp -variable diffelide -value {1 0}
- pack .bleft.mid.diff .bleft.mid.old .bleft.mid.new -side left
+ label .bleft.mid.labeldiffcontext -text " Lines of context: " \
+ -font $uifont
+ entry .bleft.mid.diffcontext -width 5 -font $textfont -textvariable diffcontextstring
+ trace add variable diffcontextstring write diffcontextchange
+ lappend entries .bleft.mid.diffcontext
+ pack .bleft.mid.diff .bleft.mid.old .bleft.mid.new .bleft.mid.labeldiffcontext .bleft.mid.diffcontext -side left
set ctext .bleft.ctext
text $ctext -background $bgcolor -foreground $fgcolor \
-tabs "[expr {$tabstop * $charspc}]" \
@@ -4872,12 +4878,25 @@ proc gettreediffline {gdtf ids} {
return 0
}
+proc diffcontextchange {n1 n2 op} {
+ global diffcontextstring diffcontext
+
+ if {[string is integer $diffcontextstring]} {
+ if {$diffcontextstring > 0} {
+ set diffcontext $diffcontextstring
+# TODO: need to trigger update of diff display
+# tried dodiffindex but that corrupted the history view
+ }
+ }
+}
+
proc getblobdiffs {ids} {
global diffopts blobdifffd diffids env
global diffinhdr treediffs
+ global diffcontext
set env(GIT_DIFF_OPTS) $diffopts
- if {[catch {set bdf [open [diffcmd $ids {-p -C}] r]} err]} {
+ if {[catch {set bdf [open [diffcmd $ids "-p -C -U$diffcontext"] r]} err]} {
puts "error getting diffs: $err"
return
}
@@ -7537,6 +7556,8 @@ set markingmatches 0
set optim_delay 16
+set diffcontext 3
+
set nextviewnum 1
set curview 0
set selectedview 0
--
1.5.3.rc3.20.g06b4
next reply other threads:[~2007-07-26 8:00 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-26 7:59 Steffen Prohaska [this message]
2007-07-26 12:34 ` [PATCH] gitk: let you easily specify lines of context in diff view Paul Mackerras
2007-07-27 5:52 ` Steffen Prohaska
2007-07-27 10:31 ` Paul Mackerras
2007-07-27 11:44 ` [PATCH v2] " Steffen Prohaska
2007-07-28 19:18 ` [PATCH v3] " Steffen Prohaska
2007-08-11 15:30 ` [PATCH v4, ping] " Steffen Prohaska
2007-08-12 3:17 ` Paul Mackerras
2007-08-12 10:02 ` Steffen Prohaska
2007-08-12 10:05 ` [PATCH v5] " Steffen Prohaska
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=11854367692095-git-send-email-prohaska@zib.de \
--to=prohaska@zib.de \
--cc=git@vger.kernel.org \
--cc=paulus@samba.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).