-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Closing a pane does not reset the PowerShell text position #2432
Comments
So this is definitely a psreadline bug, though it does seem unique to Windows Terminal. Notably, I can't seem to repro a similar scenario in a conhost window:
If this was a purely psreadline or conpty bug, then this wouldn't repro in this scenario. We'll need to do something better with the Terminal specifically. |
This is partially related to the fact that PowerShell saves and restores your cursor position across taking prompt input. That's also the cause of #2267. |
Okay with #4741 merged, this is still happening. I'm pretty sure PsReadline is saving the cursor position at the start of the prompt, and restores the position when it wants to redraw the terminal. Though, the question I have is "why isn't this happening if you just decrease, then increase the height of the terminal" This discussion from VTE seemed relevant, but I'm not surehttps://gitlab.gnome.org/GNOME/vte/blob/master/doc/rewrap.txt
EDIT 3-17-2020Okay this definitely isn't a unique problem to the Windows Terminal, but it might only be trigger-able in the Windows Terminal. The above screenshot shows WT side-by-side with the conpty that's hosting it. As you can see, in that conpty, the cursor position jumped to the bottom of the viewport. So the Terminal is doing exactly what conpty told it to here. But if you just normally resize the Terminal, it works fine: This also seems to repro with the wsl version of When I do the whole split-pane, close pane repro with a breakpoint in
A bunch of resizes down to the smaller size, then a pair back up to the larger size. |
Any ideas what might be going on here? I'm thinking that PSReadline is restoring the cursor relative to the bottom of the viewport, but I don't know where in PSReadline's code I'd go to check that out. |
The cursor position is saved after the prompt here. Console resizing has always a bit of problem, but mostly nobody noticed when the code was originally written because resizing used to be awkward. I considered moving away from .Net to INPUT_RECORD to get the resize events early in Win10 when resizing a console became much easier, but that would have made the code much less portable so I'm glad I didn't. |
BTW, @daxian-dbw maintains PSReadLine now. |
Okay I'm just pasting here for my future reference code that looks relevant Which pointed me to this function I can't be sure that's actually it, but that's certainly something to look into. It looks like I've got 2.0.0 on my powershell 5 instance, and 2.0.0-beta3 on my powershell 6.2.3 instance. Though, reading through that, it looks like I'll keep digging |
A simpler repro from #5254
More investigation from today With a plain old conhost:
this will repro without conpty. I'm struggling to figure this out on our side so I'm going to move this upstream to PowerShell/PSReadLine#1456 |
This may have been fixed in an updated PsReadline. Just need to confirm.
|
Just confirmed over here that this looks like it was fixed in PSReadline 🙌 |
Environment
Steps to reproduce
Expected behavior
Text appears at previous cursor line
Actual behavior
Text appears in blank space. Screenshots of process:
The text was updated successfully, but these errors were encountered: