gitk: fix arrow keys in input fields with Tcl/Tk >= 8.6

Tcl/Tk 8.6 introduced new events for the cursor left/right keys and apparently changed the behavior of the previous event. Let's work around that by using the new events when we are running with Tcl/Tk 8.6 or later. This fixes https://github.com/git-for-windows/git/issues/495 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>

Johannes Schindelin committed Feb 16, 2016 at 16:42 UTC ac75b4c265952e382dbd67018058a853393d4ecd
1 file changed +9 -3
gitk
+9 -3
@@ -2238,7 +2238,7 @@ proc makewindow {} {
2238 global headctxmenu progresscanv progressitem progresscoords statusw
2239 global fprogitem fprogcoord lastprogupdate progupdatepending
2240 global rprogitem rprogcoord rownumsel numcommits
2241 - global have_tk85 use_ttk NS
2241 + global have_tk85 have_tk86 use_ttk NS
2242 global git_version
2243 global worddiff
2244
@@ -2736,8 +2736,13 @@ proc makewindow {} {
2736 bind . <Key-Down> "selnextline 1"
2737 bind . <Shift-Key-Up> "dofind -1 0"
2738 bind . <Shift-Key-Down> "dofind 1 0"
2739 - bindkey <Key-Right> "goforw"
2740 - bindkey <Key-Left> "goback"
2739 + if {$have_tk86} {
2740 + bindkey <<NextChar>> "goforw"
2741 + bindkey <<PrevChar>> "goback"
2742 + } else {
2743 + bindkey <Key-Right> "goforw"
2744 + bindkey <Key-Left> "goback"
2745 + }
2746 bind . <Key-Prior> "selnextpage -1"
2747 bind . <Key-Next> "selnextpage 1"
2748 bind . <$M1B-Home> "allcanvs yview moveto 0.0"
@@ -12772,6 +12777,7 @@ set nullid2 "0000000000000000000000000000000000000001"
12777 set nullfile "/dev/null"
12778
12779 set have_tk85 [expr {[package vcompare $tk_version "8.5"] >= 0}]
12780 +set have_tk86 [expr {[package vcompare $tk_version "8.6"] >= 0}]
12781 if {![info exists have_ttk]} {
12782 set have_ttk [llength [info commands ::ttk::style]]
12783 }