Skip to content

Improve RecomputeInitialCoords to be more robust and handle a couple special cases #3074

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

Merged
merged 2 commits into from
Jan 4, 2022

Conversation

daxian-dbw
Copy link
Member

@daxian-dbw daxian-dbw commented Nov 30, 2021

PR Summary

Fix #2984
Fix PhysicalLineCount to take into account that double-cell character may get wrapped to the next line when it cannot fit in the current physical line.

Fix #2954
Handle the special case where the screen is cleared by a terminal UI utility in RecomputeInitialCoords.

Fix #1884
Improve RecomputeInitialCoords by using the old cursor position in the rendered text on screen to calculate the new initial coordinates when there is any change to _buffer and _current. Before this change, we always depend on _buffer and _current to re-calculate the new initial coordinates, but _buffer and _current may have changed when we are doing the re-calculation, for example, Escape is pressed to revert line, in which case _buffer will be reset and _current will be 0. That would result in wrong calculation and exception being thrown.

Fix #1456
Improve RecomputeInitialCoords to handle the max-size => normal-size => max-size resizing.

PR Checklist

  • PR has a meaningful title
    • Use the present tense and imperative mood when describing your changes
  • Summarized changes
  • Make sure you've added one or more new tests
  • Make sure you've tested these changes in terminals that PowerShell is commonly used in (i.e. conhost.exe, Windows Terminal, Visual Studio Code Integrated Terminal, etc.)
  • User-facing changes
    • Not Applicable
    • OR
    • Documentation needed at PowerShell-Docs
      • Doc Issue filed:
Microsoft Reviewers: Open in CodeFlow

@daxian-dbw
Copy link
Member Author

@andschwa Can you please help to self-host this PSReadLine build? It would be great if it can be used on macOS for a while before we merge this PR, just to make sure it's stable enough.
You can download the zip package from this CI build: https://ci.appveyor.com/project/PowerShell/psreadline/builds/41709712/artifacts

@andyleejordan
Copy link
Member

@daxian-dbw downloading now!

@daxian-dbw
Copy link
Member Author

Thank you @andschwa!

@daxian-dbw
Copy link
Member Author

@andschwa Can you please do a review when you have time? Thanks!
BTW, did you run into any issue while using this private build on macOS?

@daxian-dbw daxian-dbw closed this Dec 14, 2021
@daxian-dbw daxian-dbw reopened this Dec 14, 2021
@andyleejordan
Copy link
Member

@daxian-dbw No issues! But can't say I threw it through the ringer.

@daxian-dbw
Copy link
Member Author

@andschwa Any issues you ran into with this private build? Are you fine if I merge this PR?

@daxian-dbw daxian-dbw merged commit f46f15d into PowerShell:master Jan 4, 2022
@daxian-dbw daxian-dbw deleted the resize branch January 4, 2022 00:40
@daxian-dbw daxian-dbw restored the resize branch January 4, 2022 00:46
@daxian-dbw daxian-dbw deleted the resize branch January 4, 2022 00:47
@ghost
Copy link

ghost commented Jan 7, 2022

🎉 v2.2.0-beta5 has been released which incorporates this pull request. 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants