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 cursor jumps to the start under navigation keys and backspace #36584

Closed
musm opened this issue Jul 8, 2020 · 4 comments
Closed
Labels
system:windows Affects only Windows upstream The issue is with an upstream dependency, e.g. LLVM

Comments

@musm
Copy link
Contributor

musm commented Jul 8, 2020

There's a buggy behavior when hitting the backspace or the left/right/up arrows after any key which forces the cursor to jump the start of the line

See:

1

@musm musm added the system:windows Affects only Windows label Jul 8, 2020
@vtjnash
Copy link
Member

vtjnash commented Jul 8, 2020

We're often redrawing the whole line, to keep it clean. But you're just seeing how slow performing Windows is.

@vtjnash vtjnash closed this as completed Jul 8, 2020
@vtjnash vtjnash added the upstream The issue is with an upstream dependency, e.g. LLVM label Jul 8, 2020
@davidanthoff
Copy link
Contributor

I think this should stay open. Other programs, like Python, manage to have a solution on Windows that doesn't have such flickers, so it certainly seems technically feasible to have a better implementation on Windows.

I'm also seeing a similar flicker in the VS Code terminal.

Just out of curiosity: I think when I looked at this last, the way Julia behaved was that it had the VT sequences that Julia emits handled by libuv, right? And then libuv would be calling the old console APIs in Windows? I think for many reasons it would make a lot more sense to cut out the libuv part here and have the windows console itself handle the VT sequences directly if Julia is run on a reasonably recent Windows 10 version. Support for that has landed years ago in Windows 10. If I recall the situation correctly, then libuv actually supports that out-of-the-box for a while, but the libuv fork that Julia uses had this disabled? If I'm recalling all of this correctly, then we are going through very many emulation layers here, which could easily explain this flicker. And maybe things are better with the current, up-to-date APIs that Windows provides for console stuff?

@vtjnash
Copy link
Member

vtjnash commented Jul 8, 2020

None of those things are relevant here. Python doesn't flicker because it's REPL is too primitive to be useful for anything much. I don't know why VS Code doesn't implement a better renderer, though I suspect the OS might just causes enough performance issue, that it can't do better on Windows. Other platforms use the same code and don't have this issue. The "new" APIs work by adding extra emulation layers that translates the codes into commands that the conhost renderer understands, similar to libuv but with more layers of emulation.

@musm musm changed the title Windows REPL cursor jumps to the start when hitting backspace Windows REPL cursor jumps to the start under navigation keys and backspace Jul 10, 2020
@musm
Copy link
Contributor Author

musm commented Jul 10, 2020

Just some more notes for reference:

For example, the Ipython REPL (i.e. not the python) is actually very feature rich, and doesn't suffer the same problems encountered in this issue.

In the original case, when hitting backspace or the left/right arrow, and using a patched Julia and libuv fork, some of the issues of the navigation keys causing buggy REPL behavior are resolved. There's still a problem when you hit the UP arrow key, but the situation is improved with respect to left/right and backspace navigation.

Certainly something is buggy in the current implementation, it would be good to figure out the root cause and open an upstream issue to fix this. I also tested on Linux and there this is a non-issue.

Here's a comparison:

patched
2

non-patched
1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
system:windows Affects only Windows upstream The issue is with an upstream dependency, e.g. LLVM
Projects
None yet
Development

No branches or pull requests

3 participants