Skip to content

Commit 587867d

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 e5ae629 commit 587867d

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
@@ -2072,7 +2072,7 @@ proc makewindow {} {
20722072
global headctxmenu progresscanv progressitem progresscoords statusw
20732073
global fprogitem fprogcoord lastprogupdate progupdatepending
20742074
global rprogitem rprogcoord rownumsel numcommits
2075-
global have_tk85 use_ttk NS
2075+
global have_tk85 have_tk86 use_ttk NS
20762076
global git_version
20772077
global worddiff
20782078

@@ -2562,8 +2562,13 @@ proc makewindow {} {
25622562
bind . <Key-Down> "selnextline 1"
25632563
bind . <Shift-Key-Up> "dofind -1 0"
25642564
bind . <Shift-Key-Down> "dofind 1 0"
2565-
bindkey <Key-Right> "goforw"
2566-
bindkey <Key-Left> "goback"
2565+
if {$have_tk86} {
2566+
bindkey <<NextChar>> "goforw"
2567+
bindkey <<PrevChar>> "goback"
2568+
} else {
2569+
bindkey <Key-Right> "goforw"
2570+
bindkey <Key-Left> "goback"
2571+
}
25672572
bind . <Key-Prior> "selnextpage -1"
25682573
bind . <Key-Next> "selnextpage 1"
25692574
bind . <$M1B-Home> "allcanvs yview moveto 0.0"
@@ -12368,6 +12373,7 @@ set nullid2 "0000000000000000000000000000000000000001"
1236812373
set nullfile "/dev/null"
1236912374

1237012375
set have_tk85 [expr {[package vcompare $tk_version "8.5"] >= 0}]
12376+
set have_tk86 [expr {[package vcompare $tk_version "8.6"] >= 0}]
1237112377
if {![info exists have_ttk]} {
1237212378
set have_ttk [llength [info commands ::ttk::style]]
1237312379
}

0 commit comments

Comments
 (0)