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

Windows REPL autocomplete gets mixed up #4519

Closed
ncnc opened this issue Oct 14, 2013 · 8 comments
Closed

Windows REPL autocomplete gets mixed up #4519

ncnc opened this issue Oct 14, 2013 · 8 comments
Labels
REPL Julia's REPL (Read Eval Print Loop) system:windows Affects only Windows

Comments

@ncnc
Copy link
Contributor

ncnc commented Oct 14, 2013

Within the ordinary Windows REPL (i.e. running julia.bat), autocomplete initially works:

julia> Pkg.\t
Pkg.Cache               Pkg._resolve            Pkg.installed
Pkg.Dir                 Pkg.add                 Pkg.isrewritable
<snip>
julia> Pkg.

However, if I run any other command first the REPL no longer responds to the tab key, I also need to press enter for the autocomplete info to appear:

julia> 1+1
2

julia> Pkg.\t\r\n
Pkg.
Pkg.Cache               Pkg._resolve            Pkg.installed
Pkg.Dir                 Pkg.add                 Pkg.isrewritable
<snip>

Edit: Just came to think of it, some other commands also seem to leave hanging around waiting for an extra enter key.

@ncnc
Copy link
Contributor Author

ncnc commented Oct 15, 2013

I don't claim to understand the repl code, but the following "wrong" change seems to make things work again.

jl_deprep_terminal() gets called between all input lines and apparently turns i/o from raw to cooked on Windows. It looks like the corresponding code in jl_prep_terminal() sets everything back to raw, but the repl behaves like it gets stuck in cooked mode, for some reason.

diff --git a/ui/repl-readline.c b/ui/repl-readline.c
index 2e8e5bb..b424f3e 100644
--- a/ui/repl-readline.c
+++ b/ui/repl-readline.c
@@ -813,7 +813,7 @@ void jl_deprep_terminal ()
     rl_deprep_terminal();
     rl_instream = rl_in;
 #ifdef __WIN32__
-    if (jl_uv_stdin->type == UV_TTY) uv_tty_set_mode((uv_tty_t*)jl_uv_stdin,0); // cooked
+    //if (jl_uv_stdin->type == UV_TTY) uv_tty_set_mode((uv_tty_t*)jl_uv_stdin,0); // cooked
 #endif
 }

@ncnc
Copy link
Contributor Author

ncnc commented Oct 15, 2013

I digged some more and libuv seems to do everything right as far as I can tell, I don't see why it's not working.

I'm running on Windows 8 (64 bit Windows, 32 bit Julia). I was going to try it out on a WinXP machine, but I gave up after seeing some dbghelp.dll version issues (I'm opening a separate issue).

It would be interesting to know if anybody else sees this problem?

@pao
Copy link
Member

pao commented Oct 15, 2013

but I gave up after seeing some dbghelp.dll version issues (I'm opening a separate issue).

Please don't until you've read #4419, which is almost certainly the same thing.

@simonster
Copy link
Member

@StefanKarpinski reported similar problems in #4357, although since I could reproduce this issue on OS X without that PR I think the cause might be #2056. I'm not sure if it's worth trying to fix this before REPL.jl.

@vtjnash
Copy link
Member

vtjnash commented Oct 18, 2013

Setting uv_tty_set_mode does a lot more than just configure the terminal: it also installs read/write hooks so that terminal formatting and utf8 characters come through correctly. Something in all that logic could be getting confused.

@ncnc
Copy link
Contributor Author

ncnc commented Nov 3, 2013

I finally got around to trying out Julia on a WinXP machine. To my surprise the REPL autocomplete worked perfectly fine. There seems to be a difference in console behavior between WinXP and later versions, likely related to the SetConsoleMode() call.

The discussion here suggests a possible solution.

As the current REPL is soon-to-be obsolete I suppose this isn't much of a priority, but I'll leave the issue open until the new REPL is enabled.

@ncnc
Copy link
Contributor Author

ncnc commented Mar 3, 2014

This issue seems to have been fixed for me by #5973, so I'm closing it. Thanks.

@ncnc ncnc closed this as completed Mar 3, 2014
@vtjnash
Copy link
Member

vtjnash commented Mar 3, 2014

Sounds good. Yes that commit made the repl parsing much happier

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
REPL Julia's REPL (Read Eval Print Loop) system:windows Affects only Windows
Projects
None yet
Development

No branches or pull requests

4 participants