Skip to content

Fix trimming of whitespace when table is wrapped#7184

Merged
iSazonov merged 1 commit intoPowerShell:masterfrom
SteveL-MSFT:format-table-wrap
Jun 27, 2018
Merged

Fix trimming of whitespace when table is wrapped#7184
iSazonov merged 1 commit intoPowerShell:masterfrom
SteveL-MSFT:format-table-wrap

Conversation

@SteveL-MSFT
Copy link
Copy Markdown
Member

@SteveL-MSFT SteveL-MSFT commented Jun 26, 2018

PR Summary

The original algorithm used math to determine the last column that had content, however, it didn't work correctly when -Wrap is used with Format-Table. Fix is to use a simpler brute force approach by checking it cell in the table to determine if it's the last column in that row with content so that we trim trailing whitespace correctly.

Fix #7179

PR Checklist

1 2 This
Is some random
multiline content

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3 empty lines (here and in 2 other cases below) - are they necessary ?

Copy link
Copy Markdown
Member Author

@SteveL-MSFT SteveL-MSFT Jun 26, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It annoys me, too, but that is currently what PowerShell outputs. We should probably look into that as a separate issue. Created #7186

Copy link
Copy Markdown
Collaborator

@iSazonov iSazonov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems we catch all bug and now have full test set. Then we could re-write the formatting code with Span to get more clear, fast and reliable code.

@iSazonov iSazonov merged commit b1fbcee into PowerShell:master Jun 27, 2018
@SteveL-MSFT SteveL-MSFT deleted the format-table-wrap branch October 26, 2018 21:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Format-Table -Wrap is broken

3 participants