Skip to content

Commit d4b3f7d

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 06749af commit d4b3f7d

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
@@ -2076,7 +2076,7 @@ proc makewindow {} {
20762076
global headctxmenu progresscanv progressitem progresscoords statusw
20772077
global fprogitem fprogcoord lastprogupdate progupdatepending
20782078
global rprogitem rprogcoord rownumsel numcommits
2079-
global have_tk85 use_ttk NS
2079+
global have_tk85 have_tk86 use_ttk NS
20802080
global git_version
20812081
global worddiff
20822082

@@ -2566,8 +2566,13 @@ proc makewindow {} {
25662566
bind . <Key-Down> "selnextline 1"
25672567
bind . <Shift-Key-Up> "dofind -1 0"
25682568
bind . <Shift-Key-Down> "dofind 1 0"
2569-
bindkey <Key-Right> "goforw"
2570-
bindkey <Key-Left> "goback"
2569+
if {$have_tk86} {
2570+
bindkey <<NextChar>> "goforw"
2571+
bindkey <<PrevChar>> "goback"
2572+
} else {
2573+
bindkey <Key-Right> "goforw"
2574+
bindkey <Key-Left> "goback"
2575+
}
25712576
bind . <Key-Prior> "selnextpage -1"
25722577
bind . <Key-Next> "selnextpage 1"
25732578
bind . <$M1B-Home> "allcanvs yview moveto 0.0"
@@ -12498,6 +12503,7 @@ set nullid2 "0000000000000000000000000000000000000001"
1249812503
set nullfile "/dev/null"
1249912504

1250012505
set have_tk85 [expr {[package vcompare $tk_version "8.5"] >= 0}]
12506+
set have_tk86 [expr {[package vcompare $tk_version "8.6"] >= 0}]
1250112507
if {![info exists have_ttk]} {
1250212508
set have_ttk [llength [info commands ::ttk::style]]
1250312509
}

0 commit comments

Comments
 (0)