git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gitk: Fix nextfile() and more
@ 2006-09-25 13:46 OGAWA Hirofumi
  2006-09-26  5:24 ` Junio C Hamano
  0 siblings, 1 reply; 7+ messages in thread
From: OGAWA Hirofumi @ 2006-09-25 13:46 UTC (permalink / raw)
  To: git

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 . <Control-p> "$ctext yview scroll -1 units"
+    bind . <Control-n> "$ctext yview scroll 1 units"
+    bind . <Alt-v> "$ctext yview scroll -1 pages"
+    bind . <Control-v> "$ctext yview scroll 1 pages"
+    bindkey P prevfile
+    bindkey N nextfile

What do you think of this?

Thanks.
-- 
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>


Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
---

 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 . <Control-Key-Down> "allcanvs yview scroll 1 units"
     bind . <Control-Key-Prior> "allcanvs yview scroll -1 pages"
     bind . <Control-Key-Next> "allcanvs yview scroll 1 pages"
+    bind . <Control-p> "$ctext yview scroll -1 units"
+    bind . <Control-n> "$ctext yview scroll 1 units"
+    bind . <Alt-v> "$ctext yview scroll -1 pages"
+    bind . <Control-v> "$ctext yview scroll 1 pages"
     bindkey <Key-Delete> "$ctext yview scroll -1 pages"
     bindkey <Key-BackSpace> "$ctext yview scroll -1 pages"
     bindkey <Key-space> "$ctext yview scroll 1 pages"
@@ -690,6 +694,8 @@ proc makewindow {} {
     bindkey <Key-Return> {findnext 0}
     bindkey ? findprev
     bindkey f nextfile
+    bindkey P prevfile
+    bindkey N nextfile
     bind . <Control-q> doquit
     bind . <Control-f> dofind
     bind . <Control-g> {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
 	}
     }
 }
_

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2006-09-27  3:35 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-25 13:46 [PATCH] gitk: Fix nextfile() and more OGAWA Hirofumi
2006-09-26  5:24 ` Junio C Hamano
2006-09-26 15:19   ` OGAWA Hirofumi
2006-09-26 15:22   ` [PATCH] gitk: Fix nextfile() and add prevfile() OGAWA Hirofumi
2006-09-26 15:27     ` [PATCH] gitk: add some key-bind OGAWA Hirofumi
2006-09-27  0:15     ` [PATCH] gitk: Fix nextfile() and add prevfile() Paul Mackerras
2006-09-27  3:32       ` OGAWA Hirofumi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).