From d4ec30b24a8ad076771064ac71dbe5420512cc30 Mon Sep 17 00:00:00 2001 From: Max Kirillov Date: Tue, 8 Jul 2014 23:45:35 +0300 Subject: gitk: Add keybinding to switch to parent commit Signed-off-by: Max Kirillov Signed-off-by: Paul Mackerras --- gitk | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/gitk b/gitk index c8df35dee..3520bdaeb 100755 --- a/gitk +++ b/gitk @@ -2594,6 +2594,9 @@ proc makewindow {} { bind $ctext $ctxbut {pop_diff_menu %W %X %Y %x %y} bind $ctext {focus %W} bind $ctext <> rehighlight_search_results + for {set i 1} {$i < 10} {incr i} { + bind . <$M1B-Key-$i> [list go_to_parent $i] + } set maincursor [. cget -cursor] set textcursor [$ctext cget -cursor] @@ -3017,6 +3020,7 @@ proc keys {} { [mc ", n, j Move down one commit"] [mc ", z, h Go back in history list"] [mc ", x, l Go forward in history list"] +[mc "<%s-n> Go to n-th parent of current commit in history list" $M1T] [mc " Move up one page in commit list"] [mc " Move down one page in commit list"] [mc "<%s-Home> Scroll to top of commit list" $M1T] @@ -7497,6 +7501,14 @@ proc goforw {} { } } +proc go_to_parent {i} { + global parents curview targetid + set ps $parents($curview,$targetid) + if {[llength $ps] >= $i} { + selbyid [lindex $ps [expr $i - 1]] + } +} + proc gettree {id} { global treefilelist treeidlist diffids diffmergeid treepending global nullid nullid2 -- cgit v1.2.1