Skip to content

Commit f94f9c8

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 <johannes.schindelin@gmx.de>
1 parent 81d53b3 commit f94f9c8

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
@@ -2238,7 +2238,7 @@ proc makewindow {} {
22382238
global headctxmenu progresscanv progressitem progresscoords statusw
22392239
global fprogitem fprogcoord lastprogupdate progupdatepending
22402240
global rprogitem rprogcoord rownumsel numcommits
2241-
global have_tk85 use_ttk NS
2241+
global have_tk85 have_tk86 use_ttk NS
22422242
global git_version
22432243
global worddiff
22442244
@@ -2736,8 +2736,13 @@ proc makewindow {} {
27362736
bind . <Key-Down> "selnextline 1"
27372737
bind . <Shift-Key-Up> "dofind -1 0"
27382738
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+
}
27412746
bind . <Key-Prior> "selnextpage -1"
27422747
bind . <Key-Next> "selnextpage 1"
27432748
bind . <$M1B-Home> "allcanvs yview moveto 0.0"
@@ -12772,6 +12777,7 @@ set nullid2 "0000000000000000000000000000000000000001"
1277212777
set nullfile "/dev/null"
1277312778
1277412779
set have_tk85 [expr {[package vcompare $tk_version "8.5"] >= 0}]
12780+
set have_tk86 [expr {[package vcompare $tk_version "8.6"] >= 0}]
1277512781
if {![info exists have_ttk]} {
1277612782
set have_ttk [llength [info commands ::ttk::style]]
1277712783
}

0 commit comments

Comments
 (0)