[jira] [Commented] (GROOVY-6453) groovysh in Windows 7/8/10 doesn't support arrow keys and Del

2018-10-28 Thread Guy Rouillier (JIRA)


[ 
https://issues.apache.org/jira/browse/GROOVY-6453?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=1760#comment-1760
 ] 

Guy Rouillier commented on GROOVY-6453:
---

Found this via search.  I'm on Windows 7 64-bit, and tried both 
groovy-2.6.0-alpha-3 and groovy-3.0.0-alpha-3.  Cursor keys are not working in 
either one.  I'm surprised to see this issue is now 5 years old.  Is there some 
basic restriction preventing this from being corrected in groovysh?

I tried creating a groovy.rc file containing the contents from the previous 
post by Dariusz Antoniuk, but don't know where to put it.  I tried in 
\groovy-3.0.0-alpha-3\bin, \groovy-3.0.0-alpha-3\conf, and 
C:\Users\\.groovy, and it still didn't work.

> groovysh in Windows 7/8/10 doesn't support arrow keys and Del
> -
>
> Key: GROOVY-6453
> URL: https://issues.apache.org/jira/browse/GROOVY-6453
> Project: Groovy
>  Issue Type: Bug
>  Components: Groovysh
>Affects Versions: 2.2.0
> Environment: Windows 8, 64bit (v6.2, build 9200), java version 
> "1.7.0_45" SE Runtime Environment (build 1.7.0_45-b18) HotSpot 64-Bit Server 
> VM (build 24.45-b08, mixed mode), Russian locale (!)
>Reporter: Andrew P Fink
>Priority: Major
>  Labels: console, jline
>
> I have bare windows 8 with fresh JDK. I run Groovysh in cmd.exe.
> Groovysh 2.1.9 works as expected.
> Groovysh 2.2.0 doesn't react to arrow keys and Del, i.e. up key doesn't show 
> previous command, left key doesn't shift cursor etc.
> After some investigation I found what is working:
> ctrl-a   go to beginning of line
> ctrl-e   go to End of line
> ctrl-f   go Forward one char
> ctrl-b   go Backward one char
> ctrl-d   delete the char
> ctrl-h   and backspace = delete left char
> ctrl-p   recall previous line
> ctrl-n   recall next line
> ctrl-s   search
> ctrl-r   reverse search 
> It's nice and feel myself like a Linux hacker, but I want arrow keys too ;-)
> I tried different options:
> - upgrade jline2.10 to 2.11 - no effect
> - --terminal=unix - it helps, but duplicate prompt (groovy:000>) and no more 
> colors in console 
> Looks like problem lies in new jline v2 (groovysh 2.1.9 uses jline1.0)



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (GROOVY-6453) groovysh in Windows 7/8/10 doesn't support arrow keys and Del

2017-11-14 Thread Dariusz Antoniuk (JIRA)

[ 
https://issues.apache.org/jira/browse/GROOVY-6453?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16252235#comment-16252235
 ] 

Dariusz Antoniuk commented on GROOVY-6453:
--

You can add the following code to your groovy.rc as a workaround:
{noformat}
@groovy.transform.InheritConstructors
class WindowsTerminalControlCharFix extends jline.WindowsTerminal {
@Override
protected boolean isSystemIn(java.io.InputStream i) throws IOException {
// groovysh wraps the input stream in 
WrappedInputStream, need to handle this case properly to enable windows 
controll character handling
if (i instanceof 
org.codehaus.groovy.tools.shell.util.WrappedInputStream) {
return 
super.isSystemIn(((org.codehaus.groovy.tools.shell.util.WrappedInputStream)i).wrapped);
}
return super.isSystemIn(i);
}
}

// if no terminal specified use a version of windows terminal class that 
handles windows control characters properly - see 
https://issues.apache.org/jira/browse/GROOVY-6453
if (!System.getProperty("jline.terminal")) {

jline.TerminalFactory.registerFlavor(jline.TerminalFactory.Flavor.WINDOWS, 
WindowsTerminalControlCharFix.class);
System.setProperty("jline.terminal","win");
}
{noformat}

> groovysh in Windows 7/8/10 doesn't support arrow keys and Del
> -
>
> Key: GROOVY-6453
> URL: https://issues.apache.org/jira/browse/GROOVY-6453
> Project: Groovy
>  Issue Type: Bug
>  Components: Groovysh
>Affects Versions: 2.2.0
> Environment: Windows 8, 64bit (v6.2, build 9200), java version 
> "1.7.0_45" SE Runtime Environment (build 1.7.0_45-b18) HotSpot 64-Bit Server 
> VM (build 24.45-b08, mixed mode), Russian locale (!)
>Reporter: Andrew P Fink
>  Labels: console, jline
>
> I have bare windows 8 with fresh JDK. I run Groovysh in cmd.exe.
> Groovysh 2.1.9 works as expected.
> Groovysh 2.2.0 doesn't react to arrow keys and Del, i.e. up key doesn't show 
> previous command, left key doesn't shift cursor etc.
> After some investigation I found what is working:
> ctrl-a   go to beginning of line
> ctrl-e   go to End of line
> ctrl-f   go Forward one char
> ctrl-b   go Backward one char
> ctrl-d   delete the char
> ctrl-h   and backspace = delete left char
> ctrl-p   recall previous line
> ctrl-n   recall next line
> ctrl-s   search
> ctrl-r   reverse search 
> It's nice and feel myself like a Linux hacker, but I want arrow keys too ;-)
> I tried different options:
> - upgrade jline2.10 to 2.11 - no effect
> - --terminal=unix - it helps, but duplicate prompt (groovy:000>) and no more 
> colors in console 
> Looks like problem lies in new jline v2 (groovysh 2.1.9 uses jline1.0)



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)