-
Notifications
You must be signed in to change notification settings - Fork 30.2k
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
REPL on Windows doesn't display console cursor after moving #20348
Comments
@nodejs/platform-windows |
Sorry, I can't reproduce this. Does this also happen with other Node versions? Are you using some console emulators (like ConEmu)? Could you maybe provide a screenshot of the issue? |
Reproduces with all versions from node 4 to node 10 (not tested below node 4).
No, just pure command prompt.
Not sure how screenshot can help, so I'm providing screen recording. It is recorded on windows 8.1, which means that it also reproduces on windows 8.1 |
I can't reproduce this either. Does it happen every time you try it? Until we are able to reproduce your problem, let's make sure that it is not caused by a third-party application. Could you post the output of |
Yes. Here are the outputs of |
Any updates on this? I mean, it is one week from posting and still nobody is able to reproduce? Weird... |
@advanceddeveloper Sorry, I still was not able to reproduce the problem. The DLL list looks normal, I just had you check because we had issues with third-party applications injecting DLLs into node / the console in the past. Is someone else from @nodejs/platform-windows able to reproduce? |
The "tiny" delay that can be seen on the screenshot is, as I can tell exactly half-time of the blink rate, which means that the visibility state of the cursor in node.js repl is set to invisible immediatelly after moving, while in batch repl (cmd itself) or python repl cursor state is set to visible after moving. I think vsemozhetbyt's screenshot confirms the issue (I also checked on windows 7 32 and 64 bit, but on virtual machine, and able to reproduce). Also, notice that the blink rate may vary (on my pc it is 1 second), so the "tiny" delay becomes "not so tiny" delay. |
I don't know if we can do anything about it. I've took a quick look into Python code to see if there is anything related that could be used to improve Node, but could not find anything. @advanceddeveloper can you try adjusting cursor blink rate in the Keyboard properties in the Control Panel? Other than that I don't think we can do anything in Node to fix this. |
I really like my 1sec blink rate and don't want to change it.
Since all programs that use REPL (not only python) which I tested so far properly handle cursor movement, I guess that these programs don't do anything special, but probably Node.js does something (I suppose unintentionally) that hides the cursor after moving. As I know, command prompt and powershell by default show the cursor, so if the cursor after moving is hidden, it probably means that the application itself (here node.js) hides the cursor.
I'm sorry, but I can't believe that this is impossible to fix. Either Node.js or some of it's libraries affect cursor behavior. As I said, all other programs properly handle it (even programs written in C and compiled with gcc (which also means that no extra code is needed to properly handle cursor movement)), so even if some library which is used by node.js creates this weird behavior, I am sure Node.js can override it and implement correct behavior. I mean, currently it is very hard (read: impossible) to navigate in the REPL. |
I can reproduce this issue on Windows 7 but not Windows 10. |
Did more investigation: Python just uses The |
Able to reproduce with reported v10.0.0 and latest v10.6.0 using Windows 8.1 x64. |
I have the exact same problem. Node v8.11.1. I tried both command promt and powershell. I'm using Windows 7. |
Calling SetConsoleCursorInfo with CONSOLE_CURSOR_INFO::bVisible set to |
@Hakerh400: tried that (added a call to I don't know if we can do anything else besides suggesting using ConEmu in which the cursor is visible when moving. |
I have the same issue, which has been present with every version of Node I've used. I'm running Windows 7 32-bit. My current version of Node is 10.6.0. I get the disappearing cursor no matter whether I start Node through |
We've seen the same problem in Julia, and a quick google search reveals others with the problem too. From some more googling, I think MS may have fixed this bug in microsoft/terminal#269 |
Thanks for doing that digging @vtjnash! I'm not entirely sure that console bug is the same as this one though, at least from the initial report in that issue you linked to:
In the Node REPL, the cursor does consistently reappear. The issue is that its blink cycle restarts in the hidden state whenever the cursor is moved, so it remains hidden until the cursor stops moving and half the blink rate's time elapses.
As I mentioned in an earlier comment, I get exactly the same issue whether I start the Node REPL from Is the problem you've been running into with Julia closer to this behavior? I'm not familiar with the implementation of the REPL, so I could be way of track, but these might be some helpful bits of info:
From my (admittedly uninformed) observations: The only places I see the disappearing cursor problem is when running Node. I don't see it in any other console-related interface, which seems to suggest that the issue stems from something in Node's codebase or dependencies. If your research turned up any examples that match this specific behavior more closely, it might be helpful if you would share them here to help in tracking down a solution. |
I've seen that depending on various options (such as turning on the legacy rendering and the capabilities of the program driving the console) the effect can vary from almost instant (visible only as screen tearing) to full loss of cursor for many seconds after all input stops. That all seems to be the fault of conhost though, since I don't see any option for a program to command the cursor to blink/stop. If you follow the link above, you can see some example screen caps of the different ways people have seen that problem manifest for various applications and settings. |
microsoft/terminal#269 is an issue with Win10, this is a issue withe the Win7 console (the old, legacy one). From what I found out:
|
For me (on Windows 10), the modern console can show undesirable cursor flickering, but the bad delays only happen with the legacy console enabled. But I see those same effects regardless of whether I'm running just The original report was for Windows 10, so maybe there's multiple bugs here? I have a Win7 VM, but haven't booted it in years. |
Multiple bugs, or maybe using legacy console in Win10? |
This looks related to libuv/libuv#852 and libuv/libuv#866 |
No, those are not related, the issue is the console window itself. On older Windows, moving the cursor from the code restarts the blinking cycle to "not shown". There is nothing we can do about it, except to suggest using console emulator like ConEmu. Python and other apps do not show this issue, because they are using consoles built-in "get line" functionality. Node uses its own custom method, which allows us to have history and autocompletion. Besides switching REPL to use line mode (which I don't think will happen) I can't see anything that we can do about this issue. |
This is an issue only on older Windows, so I suggest just closing. Windows 7 support ends in January and almost no one uses Windows 8.1. |
They will have to upgrade within the next 5 months, and I guarantee their next OS won't be Windows 8.1. @bzoz already explained that other REPLs don't have this problem because they are more primitive. |
Most other languages do not offer as feature-rich REPL as Node does. I don't think there is anything sensible we can do here. Upgrading Windows or installing ConEmu is a valid solution. We could make a line-mode REPL but I don't think it is worth the effort. I'm going to close this issue. |
Steps to reproduce the problem:
node
and then press enterWhat is the expected behavior?
The cursor should be visible immediatelly after moving (to the left or to the right). For example, command prompt automatically displays the cursor after it has been moved. The cursor has blink rate, but after user moves it, it should be visible no matter if at the given moment the blink rate timeout suggest that it should be visible or invisible.
What went wrong?
After moving, the cursor becomes hidden. It makes navigating through the code very hard. Users need to wait one second after moving in order to find out where the cursor currently is. Using CTRL+← helps a bit skipping whole words, but it is still very hard to navigate if the code is large.
Is it a problem with Node.js itself?
I am pretty sure it is. The reason I think it is Node.js issue and not issue with command prompt is because other programs which provide REPL functionalities properly display the cursor after moving (reset the cursor blink rate to visible state). For example, Python 3.6 properly handles it.
Did this work before?
I think no.
The text was updated successfully, but these errors were encountered: