Skip to content

Commit 3fc5d98

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 d6f2f98 commit 3fc5d98

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
@@ -2099,7 +2099,7 @@ proc makewindow {} {
20992099
global headctxmenu progresscanv progressitem progresscoords statusw
21002100
global fprogitem fprogcoord lastprogupdate progupdatepending
21012101
global rprogitem rprogcoord rownumsel numcommits
2102-
global have_tk85 use_ttk NS
2102+
global have_tk85 have_tk86 use_ttk NS
21032103
global git_version
21042104
global worddiff
21052105

@@ -2597,8 +2597,13 @@ proc makewindow {} {
25972597
bind . <Key-Down> "selnextline 1"
25982598
bind . <Shift-Key-Up> "dofind -1 0"
25992599
bind . <Shift-Key-Down> "dofind 1 0"
2600-
bindkey <Key-Right> "goforw"
2601-
bindkey <Key-Left> "goback"
2600+
if {$have_tk86} {
2601+
bindkey <<NextChar>> "goforw"
2602+
bindkey <<PrevChar>> "goback"
2603+
} else {
2604+
bindkey <Key-Right> "goforw"
2605+
bindkey <Key-Left> "goback"
2606+
}
26022607
bind . <Key-Prior> "selnextpage -1"
26032608
bind . <Key-Next> "selnextpage 1"
26042609
bind . <$M1B-Home> "allcanvs yview moveto 0.0"
@@ -12599,6 +12604,7 @@ set nullid2 "0000000000000000000000000000000000000001"
1259912604
set nullfile "/dev/null"
1260012605

1260112606
set have_tk85 [expr {[package vcompare $tk_version "8.5"] >= 0}]
12607+
set have_tk86 [expr {[package vcompare $tk_version "8.6"] >= 0}]
1260212608
if {![info exists have_ttk]} {
1260312609
set have_ttk [llength [info commands ::ttk::style]]
1260412610
}

0 commit comments

Comments
 (0)