Skip to content

Commit 5808618

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 c0c6c2a commit 5808618

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

gitk-git/gitk

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2234,7 +2234,7 @@ proc makewindow {} {
22342234
global headctxmenu progresscanv progressitem progresscoords statusw
22352235
global fprogitem fprogcoord lastprogupdate progupdatepending
22362236
global rprogitem rprogcoord rownumsel numcommits
2237-
global have_tk85 use_ttk NS
2237+
global have_tk85 have_tk86 use_ttk NS
22382238
global git_version
22392239
global worddiff
22402240
@@ -2732,8 +2732,13 @@ proc makewindow {} {
27322732
bind . <Key-Down> "selnextline 1"
27332733
bind . <Shift-Key-Up> "dofind -1 0"
27342734
bind . <Shift-Key-Down> "dofind 1 0"
2735-
bindkey <Key-Right> "goforw"
2736-
bindkey <Key-Left> "goback"
2735+
if {$have_tk86} {
2736+
bindkey <<NextChar>> "goforw"
2737+
bindkey <<PrevChar>> "goback"
2738+
} else {
2739+
bindkey <Key-Right> "goforw"
2740+
bindkey <Key-Left> "goback"
2741+
}
27372742
bind . <Key-Prior> "selnextpage -1"
27382743
bind . <Key-Next> "selnextpage 1"
27392744
bind . <$M1B-Home> "allcanvs yview moveto 0.0"
@@ -12734,6 +12739,7 @@ set nullid2 "0000000000000000000000000000000000000001"
1273412739
set nullfile "/dev/null"
1273512740
1273612741
set have_tk85 [expr {[package vcompare $tk_version "8.5"] >= 0}]
12742+
set have_tk86 [expr {[package vcompare $tk_version "8.6"] >= 0}]
1273712743
if {![info exists have_ttk]} {
1273812744
set have_ttk [llength [info commands ::ttk::style]]
1273912745
}

0 commit comments

Comments
 (0)