gitk: Add keybinding to switch to parent commit

Signed-off-by: Max Kirillov <max@max630.net> Signed-off-by: Paul Mackerras <paulus@samba.org>

Max Kirillov committed Jul 8, 2014 at 23:45 UTC d4ec30b24a8ad076771064ac71dbe5420512cc30
1 file changed +12
gitk
+12
@@ -2594,6 +2594,9 @@ proc makewindow {} {
2594 bind $ctext $ctxbut {pop_diff_menu %W %X %Y %x %y}
2595 bind $ctext <Button-1> {focus %W}
2596 bind $ctext <<Selection>> rehighlight_search_results
2597 + for {set i 1} {$i < 10} {incr i} {
2598 + bind . <$M1B-Key-$i> [list go_to_parent $i]
2599 + }
2600
2601 set maincursor [. cget -cursor]
2602 set textcursor [$ctext cget -cursor]
@@ -3017,6 +3020,7 @@ proc keys {} {
3020 [mc "<Down>, n, j Move down one commit"]
3021 [mc "<Left>, z, h Go back in history list"]
3022 [mc "<Right>, x, l Go forward in history list"]
3023 +[mc "<%s-n> Go to n-th parent of current commit in history list" $M1T]
3024 [mc "<PageUp> Move up one page in commit list"]
3025 [mc "<PageDown> Move down one page in commit list"]
3026 [mc "<%s-Home> Scroll to top of commit list" $M1T]
@@ -7497,6 +7501,14 @@ proc goforw {} {
7501 }
7502 }
7503
7504 +proc go_to_parent {i} {
7505 + global parents curview targetid
7506 + set ps $parents($curview,$targetid)
7507 + if {[llength $ps] >= $i} {
7508 + selbyid [lindex $ps [expr $i - 1]]
7509 + }
7510 +}
7511 +
7512 proc gettree {id} {
7513 global treefilelist treeidlist diffids diffmergeid treepending
7514 global nullid nullid2