summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Paul Mackerras <paulus@samba.org>2008-05-10 13:15:36 +1000
committerLibravatar Paul Mackerras <paulus@samba.org>2008-05-10 13:15:36 +1000
commitf4c54b3cc4b1bbde34fe957ac03f9862ec970de3 (patch)
tree66652aa95d9a914e2dbd3511c793dc935667f218
parentgitk: Disable "Reset %s branch to here" when on a detached head (diff)
downloadtgif-f4c54b3cc4b1bbde34fe957ac03f9862ec970de3.tar.xz
gitk: Synchronize highlighting in file view for 'f' and 'b' commands
This is based on a patch by Eric Raible <raible@gmail.com>, but does things a bit more simply. Previously, 'b', backspace, and delete all did the same thing. This changes 'b' to perform the inverse of 'f'. And both of them now highlight the filename of the currently diff. This makes it easier to review and navigate the diffs associated with a particular commit using only f, b, and space because the filename of the currently display diff will be dynamically highlighted. Signed-off-by: Paul Mackerras <paulus@samba.org>
-rwxr-xr-xgitk32
1 files changed, 25 insertions, 7 deletions
diff --git a/gitk b/gitk
index 9e282e58ec..9ff25deb7c 100755
--- a/gitk
+++ b/gitk
@@ -1016,7 +1016,7 @@ proc makewindow {} {
bindkey k "selnextline 1"
bindkey j "goback"
bindkey l "goforw"
- bindkey b "$ctext yview scroll -1 pages"
+ bindkey b prevfile
bindkey d "$ctext yview scroll 18 units"
bindkey u "$ctext yview scroll -18 units"
bindkey / {dofind 1 1}
@@ -5479,26 +5479,44 @@ proc changediffdisp {} {
$ctext tag conf d1 -elide [lindex $diffelide 1]
}
+proc highlightfile {loc cline} {
+ global ctext cflist cflist_top
+
+ $ctext yview $loc
+ $cflist tag remove highlight $cflist_top.0 "$cflist_top.0 lineend"
+ $cflist tag add highlight $cline.0 "$cline.0 lineend"
+ $cflist see $cline.0
+ set cflist_top $cline
+}
+
proc prevfile {} {
- global difffilestart ctext
- set prev [lindex $difffilestart 0]
+ global difffilestart ctext cmitmode
+
+ if {$cmitmode eq "tree"} return
+ set prev 0.0
+ set prevline 1
set here [$ctext index @0,0]
foreach loc $difffilestart {
if {[$ctext compare $loc >= $here]} {
- $ctext yview $prev
+ highlightfile $prev $prevline
return
}
set prev $loc
+ incr prevline
}
- $ctext yview $prev
+ highlightfile $prev $prevline
}
proc nextfile {} {
- global difffilestart ctext
+ global difffilestart ctext cmitmode
+
+ if {$cmitmode eq "tree"} return
set here [$ctext index @0,0]
+ set line 1
foreach loc $difffilestart {
+ incr line
if {[$ctext compare $loc > $here]} {
- $ctext yview $loc
+ highlightfile $loc $line
return
}
}