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 <redacted>
---
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
From: Paul Mackerras <hidden> Date: 2016-06-15 22:43:24
Steffen Prohaska writes:
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.
Nice idea! I suggest you use a spinbox instead of an entry though,
since that has up and down buttons, and allows you to restrict the
value to an integer.
* I don't know how to update the view after entering a new value.
You can put a trace on the associated variable and specify a function
to be called when the variable's value changes. Grep for "trace add
variable" in gitk to see how it's done.
Paul.
On Jul 26, 2007, at 2:34 PM, Paul Mackerras wrote:
Steffen Prohaska writes:
quoted
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.
Nice idea! I suggest you use a spinbox instead of an entry though,
since that has up and down buttons, and allows you to restrict the
value to an integer.
Thanks. Will try that.
quoted
* I don't know how to update the view after entering a new value.
You can put a trace on the associated variable and specify a function
to be called when the variable's value changes. Grep for "trace add
variable" in gitk to see how it's done.
This is already included in the patch but I don't know which of gtk's
procs to call to update the view. gitk would need to execute git diff
and update the text box in the bottom left. I tried 'dodiffindex'
but this causes corruptions of the history view.
Steffen
From: Paul Mackerras <hidden> Date: 2016-06-15 22:43:24
Steffen Prohaska writes:
This is already included in the patch but I don't know which of gtk's
procs to call to update the view. gitk would need to execute git diff
and update the text box in the bottom left. I tried 'dodiffindex'
but this causes corruptions of the history view.
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. The number of lins ines of context is initially
always set to 3.
Signed-off-by: Steffen Prohaska <redacted>
---
gitk | 41 +++++++++++++++++++++++++++++++++++++++--
1 files changed, 39 insertions(+), 2 deletions(-)
I included the changes proposed by Paul. From my side, the patch
is ready to be applied.
Steffen
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. The number of lines of context is initially
always set to 3.
Signed-off-by: Steffen Prohaska <redacted>
---
gitk | 41 +++++++++++++++++++++++++++++++++++++++--
1 files changed, 39 insertions(+), 2 deletions(-)
rebased to the current master.
Steffen
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. The number of lines of context is initially
always set to 3.
Signed-off-by: Steffen Prohaska <redacted>
---
gitk | 41 +++++++++++++++++++++++++++++++++++++++--
1 files changed, 39 insertions(+), 2 deletions(-)
rebased to the current master, fixed one trailing whitespace.
Any chance to get this patch applied? It works for me.
Steffen
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. The number of lines of context is saved to
~/.gitk.
Signed-off-by: Steffen Prohaska <redacted>
---
gitk | 34 ++++++++++++++++++++++++++++++++--
1 files changed, 32 insertions(+), 2 deletions(-)
@@ -968,7 +979,7 @@ proc savestuff {w} { global maxwidth showneartags showlocalchanges global viewname viewfiles viewargs viewperm nextviewnum global cmitmode wrapcomment- global colors bgcolor fgcolor diffcolors selectbgcolor+ global colors bgcolor fgcolor diffcolors diffcontext selectbgcolor if {$stuffsaved} return if {![winfo viewable .]} return
@@ -989,6 +1000,7 @@ proc savestuff {w} { puts $f [list set fgcolor $fgcolor] puts $f [list set colors $colors] puts $f [list set diffcolors $diffcolors]+ puts $f [list set diffcontext $diffcontext] puts $f [list set selectbgcolor $selectbgcolor] puts $f "set geometry(main) [wm geometry .]"
@@ -4986,12 +4998,29 @@ proc gettreediffline {gdtf ids} { return 0 }+# empty string or positive integer+proc diffcontextvalidate {v} {+ return [regexp {^(|[1-9][0-9]*)$} $v]+}++proc diffcontextchange {n1 n2 op} {+ global diffcontextstring diffcontext++ if {[string is integer -strict $diffcontextstring]} {+ if {$diffcontextstring > 0} {+ set diffcontext $diffcontextstring+ reselectline+ }+ }+}+ 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 --no-commit-id}] r]} err]} {+ if {[catch {set bdf [open [diffcmd $ids "-p -C --no-commit-id -U$diffcontext"] r]} err]} { puts "error getting diffs: $err" return }
@@ -7569,6 +7598,7 @@ set colors {green red blue magenta darkgrey brown orange} set bgcolor white set fgcolor black set diffcolors {red "#00a000" blue}+set diffcontext 3 set selectbgcolor gray85 catch {source ~/.gitk}