From: OGAWA Hirofumi Date: Mon, 25 Sep 2006 13:46:52 GMT Subject: [PATCH] gitk: Fix nextfile() and more Message-ID: <873bag12k3.fsf@duaron.myhome.or.jp> Hi, The current nextfile() jumps to last hunk, but I think this is not intention, probably, it's forgetting to add "break;". Right? And this patch also adds prevfile(), it jumps to previous hunk. The following part is just my favorite the key-binds, it doesn't matter. + bind . "$ctext yview scroll -1 units" + bind . "$ctext yview scroll 1 units" + bind . "$ctext yview scroll -1 pages" + bind . "$ctext yview scroll 1 pages" + bindkey P prevfile + bindkey N nextfile What do you think of this? Thanks. -- OGAWA Hirofumi Signed-off-by: OGAWA Hirofumi --- gitk | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff -puN gitk~gitk-key-emacs gitk --- git/gitk~gitk-key-emacs 2006-09-25 22:31:51.000000000 +0900 +++ git-hirofumi/gitk 2006-09-25 22:31:51.000000000 +0900 @@ -672,6 +672,10 @@ proc makewindow {} { bind . "allcanvs yview scroll 1 units" bind . "allcanvs yview scroll -1 pages" bind . "allcanvs yview scroll 1 pages" + bind . "$ctext yview scroll -1 units" + bind . "$ctext yview scroll 1 units" + bind . "$ctext yview scroll -1 pages" + bind . "$ctext yview scroll 1 pages" bindkey "$ctext yview scroll -1 pages" bindkey "$ctext yview scroll -1 pages" bindkey "$ctext yview scroll 1 pages" @@ -690,6 +694,8 @@ proc makewindow {} { bindkey {findnext 0} bindkey ? findprev bindkey f nextfile + bindkey P prevfile + bindkey N nextfile bind . doquit bind . dofind bind . {findnext 0} @@ -4440,12 +4446,26 @@ 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 + break + } + set prev $loc + } +} + proc nextfile {} { global difffilestart ctext set here [$ctext index @0,0] foreach loc $difffilestart { if {[$ctext compare $loc > $here]} { $ctext yview $loc + break } } } _