Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Arrow keys don't work on Windows #121

Closed
vmarcinko opened this Issue · 8 comments

3 participants

@vmarcinko

My environment is Windows 7 64-bit, and I use Leiningen 2.2.0 to start repl-y via "lein repl":from standard Windows terminal (cmd):
nREPL server started on port 57197
REPL-y 0.2.0
Clojure 1.5.1

But when I try to navigate command history using up/down keys, it display some messy characters instead.

@trptcolin
Owner

What are the messy characters, please?

@trptcolin
Owner

The reason I'm asking for more detail, by the way, is because arrow keys work just fine on my Windows VM, on that same version of REPLy (which implies the same jline version).

You might take a look at this issue for some steps to see exactly what key codes are being emitted, and apparently not understood by jline: jline/jline2#84 - this is the command that will build jline and print debug info:

mvn package && java -Djline.internal.Log.trace=true -cp target/jline-2.11-SNAPSHOT-tests.jar:target/jline-2.11-SNAPSHOT.jar jline.example.Example none

(You'll need to check those paths to account for the latest jline version, and maybe format the classpath using semicolons and backslashes, however Windows wants them.)

Also, if you have an .inputrc or jline.inputrc file in the directory that java finds for the user.home system property, the configurations there will take precedence over defaults.

@vmarcinko

I tried the jLine testing procedure you suggested, and here is printout for all "broken" arrow keys in order up/down/left/right:

[DEBUG] Creating terminal; type=auto
[DEBUG] Created Terminal: jline.AnsiWindowsTerminal@7e0df50
[DEBUG] Registering shutdown-hook: Thread[JLine Shutdown Hook,5,main]
[DEBUG] Adding shutdown-hook task: jline.TerminalSupport$1@735cda3f
[DEBUG] Ansi supported: true
[DEBUG] Direct console: true
[DEBUG] Echo enabled: false
[DEBUG] NonBlockingInputStream start

"up":

prompt> [TRACE] Keystroke: 341
[TRACE] Binding: SELF_INSERT
Ó[TRACE] Keystroke: 72
[TRACE] Binding: SELF_INSERT
H

"down":

[TRACE] Keystroke: 341
[TRACE] Binding: SELF_INSERT
Ó[TRACE] Keystroke: 80
[TRACE] Binding: SELF_INSERT
P

"left":

[TRACE] Keystroke: 341
[TRACE] Binding: SELF_INSERT
Ó[TRACE] Keystroke: 75
[TRACE] Binding: SELF_INSERT
K

"right":

[TRACE] Keystroke: 341
[TRACE] Binding: SELF_INSERT
Ó[TRACE] Keystroke: 77
[TRACE] Binding: SELF_INSERT
M

@timonwong

I have similar issue, the diagnostic program gives me following result:

[DEBUG] Creating terminal; type=auto
[DEBUG] Created Terminal: jline.AnsiWindowsTerminal@3612afd8
[DEBUG] Registering shutdown-hook: Thread[JLine Shutdown Hook,5,main]
[DEBUG] Adding shutdown-hook task: jline.TerminalSupport$1@70d00109
[DEBUG] Ansi supported: true
[DEBUG] Direct console: true
[DEBUG] Echo enabled: false
[DEBUG] NonBlockingInputStream start

>>>> UP

prompt> [TRACE] Keystroke: 37074
[TRACE] Binding: SELF_INSERT

>>>> DOWN

郒[TRACE] Keystroke: 37087
[TRACE] Binding: SELF_INSERT

>>>> LEFT
郟[TRACE] Keystroke: 37078
[TRACE] Binding: SELF_INSERT

>>>> RIGHT

郖[TRACE] Keystroke: 37081
[TRACE] Binding: SELF_INSERT

>>>> HOME

郙[TRACE] Keystroke: 37069
[TRACE] Binding: SELF_INSERT

>>>> END

郍[TRACE] Keystroke: 37086
[TRACE] Binding: SELF_INSERT
郞
@trptcolin
Owner

Sorry to take so long getting back to y'all on this. Arrow keys are an even bigger mess across OSes and locales than I thought, it seems. I'm making a note on the upstream ticket. Thanks for reporting this!

@trptcolin
Owner

To clarify what I meant by "upstream ticket", I have a note with a possible workaround on jline/jline2#100 and I'd love to hear whether you can work around this with $HOME/.inputrc or $HOME/jline.inputrc entries.

@trptcolin
Owner

This will be fixed in the next release by the jline fix in jline/jline2#134

@trptcolin
Owner

Should be fixed in REPLy 0.3.1 (included in lein 2.4.2). Thanks!

@trptcolin trptcolin closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.