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

Restore down then maximizing the Windows Terminal causes PSReadline to misplace the cursor #1456

Closed
zadjii-msft opened this issue Apr 6, 2020 · 1 comment · Fixed by #3074
Assignees
Labels
Issue-Bug It either shouldn't be doing this or needs an investigation. Resolution-Fixed

Comments

@zadjii-msft
Copy link

Environment

From conhost:

PS version: 7.0.0
PSReadline version: 2.0.0
os: 10.0.19601.1000 (WinBuild.160101.0800)
PS file version: 7.0.0.0
HostName: ConsoleHost
BufferWidth: 248
BufferHeight: 68

Additionally, from WT:

PS version: 7.0.0
PSReadline version: 2.0.0
os: 10.0.19601.1000 (WinBuild.160101.0800)
PS file version: 7.0.0.0
HostName: ConsoleHost (Windows Terminal)
BufferWidth: 120
BufferHeight: 30

Steps to reproduce

See microsoft/terminal#2432 and microsoft/terminal#5254

Windows Terminal Repro

  1. Open Terminal in full screen
  2. Type ls
  3. unmaximize the window
  4. maximize the window
  5. type ls again and see that ls is not positioned correctly

displaybug

Conhost repro

With a plain old conhost:

  • Maximize it
  • Run ls
  • Restore down
  • Change the buffer size to match the window size
  • Maximize again

Expected behavior

Text appears at previous cursor line

Actual behavior

Text appears in blank space. Screenshots of process:

pane-text-1

pane-text-2

pane-text-3

Notes

I'm moving this here because I'm having a hard time tracing through this from our side, and I figured it'd be easier to get help straight from the experts. From my own investigation

This issue: PowerShell/PSReadLine#682
and the associated PR: PowerShell/PSReadLine#694

Which pointed me to this function
PowerShell/PSReadLine:PSReadLine/Render.cs@198a643#L985-L1000

I can't be sure that's actually it, but that's certainly something to look into.

Though, reading through that, it looks like _console.CursorTop might already be wrong at that point in the call. Looks like that function is just trying to see how many rows the input line takes, then is setting the _initialY to be that many rows above the cursor. So I'd think the cursor was already wrong at this point.

I'll keep digging

@ghost ghost added the Needs-Triage 🔍 It's a new issue that core contributor team needs to triage. label Apr 6, 2020
@daxian-dbw daxian-dbw added Needs-More Investigation Initial investigation is done, but need to follow up. and removed Needs-Triage 🔍 It's a new issue that core contributor team needs to triage. labels Apr 21, 2020
@daxian-dbw daxian-dbw self-assigned this May 20, 2020
@daxian-dbw daxian-dbw added Issue-Bug It either shouldn't be doing this or needs an investigation. and removed Needs-More Investigation Initial investigation is done, but need to follow up. labels Nov 9, 2021
@daxian-dbw daxian-dbw added this to the 2.2.0-Consider milestone Nov 9, 2021
@ghost ghost added the In-PR A PR is opened targeting the issue label Nov 30, 2021
@ghost ghost added Resolution-Fixed and removed In-PR A PR is opened targeting the issue labels Jan 4, 2022
@ghost
Copy link

ghost commented Jan 7, 2022

🎉 This issue was addressed in 3074, which has now been successfully released in v2.2.0-beta5. 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Bug It either shouldn't be doing this or needs an investigation. Resolution-Fixed
Projects
None yet
2 participants