Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IntelliJ Console doesn't seem to be supported on Windows. Pressing enter does not submit the value #185

Open
yeison opened this issue Apr 17, 2015 · 9 comments

Comments

@yeison
Copy link

yeison commented Apr 17, 2015

If I run a ConsoleReader in IntelliJ, the input doesn't seem to end on new-line.

@yeison
Copy link
Author

yeison commented Apr 17, 2015

The same problem in Eclipse - note I believe it's only a problem in Windows.

@yeison
Copy link
Author

yeison commented Apr 17, 2015

Seem to have narrowed part of the problem to line 156 in WindowsTerminal.java - It just continues in an infinite loop even though I enter some input

@gnodet
Copy link
Member

gnodet commented Jul 20, 2015

You could try forcing the use of the UnsupportedTerminal instead, or setting jline.WindowsTerminal.directConsole=false as a system property.

We may be able to improve the terminal factory detection code. If you want to give it a try, feel free to investigate.

@westonal
Copy link

I used this to force unsupported:

jline.TerminalFactory.registerFlavor(jline.TerminalFactory.Flavor.WINDOWS, UnsupportedTerminal.class);

And input works but completion does not. Is that expected behavior of Unsupported terminal?

@Krasnyanskiy
Copy link

The same for Mac OS. See my opened issue. Autocompletion does not work in IDEA terminal when you debugging the code.

@westonal
Copy link

@gnodet I've investigated and I understand why the same issue occurs on windows, the WindowsTerminal class is attempting to hook in to the command window with various dll calls that are obviously unsuitable for the kind of terminal IDEA is using. I imagine the issue is the same kind of problem in any other OS.

Detection would be nice, but it is not going to solve this issue, that you can't debug in IDEA.

I'm going to try and contact people who write IDEA and also look at the source for it here: https://github.com/JetBrains/intellij-community to try to work out what kind of terminal and how we can hook into it with a different Terminal implementation.

@Vity01
Copy link

Vity01 commented Jun 29, 2018

Any progress on this?

@gnodet
Copy link
Member

gnodet commented Jul 4, 2018

THere's no way to have completion in the Intellij Console, mainly because Intellij will not transmet any character before hitting the key.
Also, there's no real way to detect that the process is running in the Intellij Console using environment variables for example.

Workarounds include:

  • setting an environment variable TERM=dumb
  • setting the system variable jline.terminal=none or in jline's config file
  • registering a specific flavor for your os using TerminalFactory.registerFlavor(TerminalFactory.Flavor.WINDOWS, UnsupportedTerminal.class)

@sbernard31
Copy link

sbernard31 commented Jul 29, 2021

If you are using picocli with jline2.

You can delegate the heuristic to picocli which seems better than the jline2 heuristic.

The code can looks like :

        // JLine 2 does not detect some terminal as not ANSI compatible, like Eclipse Console
        // see : https://github.com/jline/jline2/issues/185
        // So use picocli heuristic instead :
        if (!Help.Ansi.AUTO.enabled() && //
                Configuration.getString(TerminalFactory.JLINE_TERMINAL, TerminalFactory.AUTO).toLowerCase()
                        .equals(TerminalFactory.AUTO)) {
            TerminalFactory.configure(Type.NONE);
        }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants