-
Notifications
You must be signed in to change notification settings - Fork 8.5k
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
Command History on wrong line #6546
Comments
FWIW, this just happened to me again and there was no window resizing involved. I have a CMD script that updates the test copies of the software I'm working on that emits 5 lines, does a PAUSE, then emits 17 more. My process is to stop my software, run the script and restart my software (which is actually loaded by a small Windows program that I start from the command line -- nothing of mine is a command line program.) After having down that a few times, enough to cause the window to scroll, the behavior I originally described occurs. The terminal window HAD been MOVED but not resized at the time I saw this today. So, I may be able to trigger this on demand, if there is anything I can do to help debug/test this, please let me know. |
I do see something very similar to this with no resizing involved. The last couple of lines at the bottom of the terminal can become unavailable for input, and input is overdrawn one or two lines above. It happens randomly, but only rarely--a couple of time a week for me. I have not been able to reproduce the problem. I'm more than happy to create a minidump or perform other debugging when I see this. |
[using 1.0.1401.0] Not sure this is related but I just rebooted and used a Command Prompt tab to restore three network drives by doing "dir P:" (and Q: and R: if it matters). This, of course, caused the text in the tab to scroll for at least a few pages. I then started to enter another command and pressed ESCAPE to erase it. Instead of being erased, the input cursor jumped to just after my prompt ON THE PREVIOUS LINE. Once this happened, it happened any time I used escape to erase a command. Unfortunately, after restarting the terminal program and opening a new Command Prompt tab I was, of course, unable to get it to happen again. Are there instructions for capturing anything useful that I can follow if I see this happening again? |
Hi, I also frequently see this problem. Here are some information I know:
In this screenshot, the text is at the 3rd line (2 lines lower). If I scroll back to the top, it is exactly where the prompt |
Using |
I just tried this exact sequence again and it didn't repro :( |
I just noticed that when the caret is dangerously close to the bottom of the screen it sometimes scrolls one line up to bring the caret up further away from the bottom edge, and that scroll happens almost simultaneously with text output. Is there a lock around that scroll action and the text output? Certainly feels like a race condition where something is not transactional and side effects from scrolling and output are observed before an operation completes. I'm just speculating of course since I haven't debugged or even looked at the code. |
Could we consider bumping the priority on this please? Surprised that corruption and inconsistency of core internal data structures is prioritized as P3. The core data structures should be rock solid and we should do tons of stress testing and fuzzing to catch these issues. |
Hooplah, a consistent repro from #9897
I'll add that I |
Is there any news about this issue or ETA on fix? For me that issue ruining terminal usage experience every day, when it garbage the output and I need to do the resize window workaround and re-run the command again. |
This comment has been minimized.
This comment has been minimized.
terminal vs pty. Doesn't seem like #5368 affects this though, same thing in just conhost: OH BUT INTERESTING. If you set conhost's buffer to be the same size as the viewport, then it'll repro exactly the same. Furthermore, same will happen with conhost+cmd.exe+buffer.size=viewport.size |
Okay I'm getting too into the weeds here I think. These feel like issues that'll just go away with #8000. There's weirdness going on where it seems like the TextBuffer circled once to leave a space for this line where the cursor should be, but the cursor is actually at the start of the prompt (and the prompt isn't in the buffer during the resize). So it ends up redrawing itself where it was, which is now a blank line. But that blank line should have never existed! |
We're hitting the case where the last row of the buffer thinks it was wrapped, so we fill all the spaces into the new buffer. But that's not really the case! The commandline was hidden, so that line shouldn't be marked as wrapped! EDIT: But, this makes me think that this particular repro isn't the same root cause as the other bugs. This is just the |
Subjectively speaking, this commit makes 3 improvements: * Most importantly, it now would work with arbitrary Unicode text. (No more `IsGlyphFullWidth` or DBCS handling during reflow.) * Due to the simpler implementation it hopefully makes review of future changes and maintenance simpler. (~3x less LOC.) * It improves perf. by 1-2 orders of magnitude. (At 120x9001 with a full buffer I get 60ms -> 2ms.) Unfortunately, I'm not confident that the new code replicates the old code exactly, because I failed to understand it. During development I simply tried to match its behavior with what I think reflow should do. Closes #797 Closes #3088 Closes #4968 Closes #6546 Closes #6901 Closes #15964 Closes MSFT:19446208 Related to #5800 and #8000 ## Validation Steps Performed * Unit tests ✅ * Feature tests ✅ * Reflow with a scrollback ✅ * Reflowing the cursor cell causes a forced line-wrap ✅ (Even at the end of the buffer. ✅) * `color 8f` and reflowing retains the background color ✅ * Enter alt buffer, Resize window, Exit alt buffer ✅
Subjectively speaking, this commit makes 3 improvements: * Most importantly, it now would work with arbitrary Unicode text. (No more `IsGlyphFullWidth` or DBCS handling during reflow.) * Due to the simpler implementation it hopefully makes review of future changes and maintenance simpler. (~3x less LOC.) * It improves perf. by 1-2 orders of magnitude. (At 120x9001 with a full buffer I get 60ms -> 2ms.) Unfortunately, I'm not confident that the new code replicates the old code exactly, because I failed to understand it. During development I simply tried to match its behavior with what I think reflow should do. Closes #797 Closes #3088 Closes #4968 Closes #6546 Closes #6901 Closes #15964 Closes MSFT:19446208 Related to #5800 and #8000 ## Validation Steps Performed * Unit tests ✅ * Feature tests ✅ * Reflow with a scrollback ✅ * Reflowing the cursor cell causes a forced line-wrap ✅ (Even at the end of the buffer. ✅) * `color 8f` and reflowing retains the background color ✅ * Enter alt buffer, Resize window, Exit alt buffer ✅ (cherry picked from commit 7474839) Service-Card-Id: 90642727 Service-Version: 1.19
@alrz Could you open a new issue for this? It'd be especially nice if you had a repro case for us. |
Environment
Steps to reproduce
Cannot reproduce on demand, but I know it occurred after dragging the window to a new size (number of rows and columns.)
Expected behavior
I was in a Command Prompt, using the Up Arrow to recall my command history.
I expected the recalled commands to appear on the current command line.
Actual behavior
The FIRST command recalled appeared on the current command line, subsequently recalled commands (I pressed Up Arrow more than once) appeared one row above but indented as if after a prompt (though the line above was previously blank.)
FWIW, this is not the first issue I've seen after resizing the window, but almost all of them go away after another resize and do not return if I try to return to the previous size and test for them. So the triggers are difficult to define, sorry. Hopefully this will at least warrant some comments near where this is handled, just in case something is noticed in the code. :-)
The text was updated successfully, but these errors were encountered: