Skip to content

Fix trimming of whitespace when table is wrapped - #7184

Merged
Ilya (iSazonov) merged 1 commit into
PowerShell:masterfrom
SteveL-MSFT:format-table-wrap
Jun 27, 2018
Merged

Fix trimming of whitespace when table is wrapped#7184
Ilya (iSazonov) merged 1 commit into
PowerShell:masterfrom
SteveL-MSFT:format-table-wrap

Conversation

@SteveL-MSFT

@SteveL-MSFT Steve Lee (SteveL-MSFT) commented Jun 26, 2018

Copy link
Copy Markdown
Member

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 ?

@SteveL-MSFT Steve Lee (SteveL-MSFT) Jun 26, 2018

Copy link
Copy Markdown
Member Author

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

@iSazonov Ilya (iSazonov) left a comment

Copy link
Copy Markdown
Collaborator

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
Ilya (iSazonov) merged commit b1fbcee into PowerShell:master Jun 27, 2018
@SteveL-MSFT
Steve Lee (SteveL-MSFT) deleted the format-table-wrap branch October 26, 2018 21:35
Thatgfsj (Thatgfsj) pushed a commit to Thatgfsj-contribs/PowerShell that referenced this pull request Aug 6, 2026
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