From: OGAWA Hirofumi Date: Wed, 27 Sep 2006 03:32:19 +0000 (+0900) Subject: [PATCH] gitk: Fix nextfile() and add prevfile() X-Git-Url: https://privyetmir.co.uk/gitweb.cgi?a=commitdiff_plain;h=67c22874cf82edae9b5c5f0a47c432d08d7ad426;p=gitk [PATCH] gitk: Fix nextfile() and add prevfile() 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 Signed-off-by: Paul Mackerras --- diff --git a/gitk b/gitk index ebbeac6..ab383b3 100755 --- 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 } } }