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
Fix the word wrapping in formatting to handle escape sequences properly #17316
Conversation
src/System.Management.Automation/FormatAndOutput/common/ComplexWriter.cs
Outdated
Show resolved
Hide resolved
src/System.Management.Automation/FormatAndOutput/common/ComplexWriter.cs
Outdated
Show resolved
Hide resolved
src/System.Management.Automation/FormatAndOutput/common/ComplexWriter.cs
Show resolved
Hide resolved
src/System.Management.Automation/FormatAndOutput/common/ComplexWriter.cs
Show resolved
Hide resolved
src/System.Management.Automation/FormatAndOutput/common/ComplexWriter.cs
Show resolved
Hide resolved
src/System.Management.Automation/FormatAndOutput/common/ComplexWriter.cs
Show resolved
Hide resolved
|
This PR has Quantification details
Why proper sizing of changes matters
Optimal pull request sizes drive a better predictable PR flow as they strike a
What can I do to optimize my changes
How to interpret the change counts in git diff output
Was this comment helpful? |
src/System.Management.Automation/FormatAndOutput/common/ComplexWriter.cs
Show resolved
Hide resolved
|
Handy links: |


PR Summary
Fix #17261
Fix the word wrapping in formatting to handle escape sequences properly.
The changes are mainly in 3 utility methods to take into account possible escape sequences when manipulate strings:
SplitLines: split a multi-line string. Make sure the escape sequences are kept for all lines after the splitting.GetWords: split a single-line string into words. Make sure all escape sequences are kept for each word, so the decoration to the individual words is the same as they are in the string.GenerateLinesWithWordWrap. When splitting a word across multiple lines, make sure all escape sequences are kept in the same order for all individual sub-strings, so the decoration to the sub-strings is the same as they are in the original string.Here are some examples to demonstrate the fix:
Multi-line string in list view
Multi-line string in list view with word wrapping
Long word across multiple lines
PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerWIP:or[ WIP ]to the beginning of the title (theWIPbot will keep its status check atPendingwhile the prefix is present) and remove the prefix when the PR is ready.