Skip to content

Commit 724d0ca

Browse files
committed
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 #495 Signed-off-by: Johannes Schindelin <[email protected]>
1 parent cedb33a commit 724d0ca

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

gitk-git/gitk

+9-3
Original file line numberDiff line numberDiff line change
@@ -2079,7 +2079,7 @@ proc makewindow {} {
20792079
global headctxmenu progresscanv progressitem progresscoords statusw
20802080
global fprogitem fprogcoord lastprogupdate progupdatepending
20812081
global rprogitem rprogcoord rownumsel numcommits
2082-
global have_tk85 use_ttk NS
2082+
global have_tk85 have_tk86 use_ttk NS
20832083
global git_version
20842084
global worddiff
20852085

@@ -2577,8 +2577,13 @@ proc makewindow {} {
25772577
bind . <Key-Down> "selnextline 1"
25782578
bind . <Shift-Key-Up> "dofind -1 0"
25792579
bind . <Shift-Key-Down> "dofind 1 0"
2580-
bindkey <Key-Right> "goforw"
2581-
bindkey <Key-Left> "goback"
2580+
if {$have_tk86} {
2581+
bindkey <<NextChar>> "goforw"
2582+
bindkey <<PrevChar>> "goback"
2583+
} else {
2584+
bindkey <Key-Right> "goforw"
2585+
bindkey <Key-Left> "goback"
2586+
}
25822587
bind . <Key-Prior> "selnextpage -1"
25832588
bind . <Key-Next> "selnextpage 1"
25842589
bind . <$M1B-Home> "allcanvs yview moveto 0.0"
@@ -12573,6 +12578,7 @@ set nullid2 "0000000000000000000000000000000000000001"
1257312578
set nullfile "/dev/null"
1257412579

1257512580
set have_tk85 [expr {[package vcompare $tk_version "8.5"] >= 0}]
12581+
set have_tk86 [expr {[package vcompare $tk_version "8.6"] >= 0}]
1257612582
if {![info exists have_ttk]} {
1257712583
set have_ttk [llength [info commands ::ttk::style]]
1257812584
}

0 commit comments

Comments
 (0)