[PATCH] gitk: Fix nextfile() and add prevfile()
authorOGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Wed, 27 Sep 2006 03:32:19 +0000 (12:32 +0900)
committerPaul Mackerras <paulus@samba.org>
Thu, 19 Oct 2006 00:10:11 +0000 (10:10 +1000)
The current nextfile() jumps to last hunk, but I think this is not
intention, probably, it's forgetting to add "break;". And this
patch also adds prevfile(), it jumps to previous hunk.

Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Signed-off-by: Paul Mackerras <paulus@samba.org>
gitk

diff --git a/gitk b/gitk
index ebbeac63aaac66c3ffef53c1d66836c11d22ddbf..ab383b3ad29cea5c7c45a8f757941acbc3abaf33 100755 (executable)
--- a/gitk
+++ b/gitk
@@ -4440,12 +4440,27 @@ proc getblobdiffline {bdf ids} {
     }
 }
 
+proc prevfile {} {
+    global difffilestart ctext
+    set prev [lindex $difffilestart 0]
+    set here [$ctext index @0,0]
+    foreach loc $difffilestart {
+       if {[$ctext compare $loc >= $here]} {
+           $ctext yview $prev
+           return
+       }
+       set prev $loc
+    }
+    $ctext yview $prev
+}
+
 proc nextfile {} {
     global difffilestart ctext
     set here [$ctext index @0,0]
     foreach loc $difffilestart {
        if {[$ctext compare $loc > $here]} {
            $ctext yview $loc
+           return
        }
     }
 }