Skip to content

Conversation

@SteveL-MSFT
Copy link
Member

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

PR Summary

Table formatter was overly aggressive in removing padding so even right justified output (default of numbers) gets incorrectly stripped of padding. Fix is when right justified, always add padding (because it's right justified, there's never trailing whitespace).

Note that the GitHub diff view is confused about the new test case since the code is similar. Didn't want to add more variations to the previous test case as the intent is different even though the code is similar.

Fix #7078

PR Checklist

a b
- -
123 abc
Copy link
Collaborator

Choose a reason for hiding this comment

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

Interesting,

  1. should we justify header fields? Maybe always have left/center/right justify?
  2. should we pad "-" to length of values not headers?
a   b
--- ---
123 abc

Copy link
Member Author

Choose a reason for hiding this comment

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

Maybe, but that's an enhancement. I would suggest opening a new issue to discuss that. This PR makes this consistent with Windows PowerShell existing behavior.

Choose a reason for hiding this comment

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

Does this mean that this issue only happens on PS Core?

Copy link
Member Author

Choose a reason for hiding this comment

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

@anmenaga yes, this is a regression in PSCore6.1

a b
- -
123 abc

Choose a reason for hiding this comment

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

Does this mean that this issue only happens on PS Core?

Copy link
Collaborator

@powercode powercode left a comment

Choose a reason for hiding this comment

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

LGTM

@iSazonov iSazonov merged commit e8d2a6b into PowerShell:master Jun 26, 2018
daxian-dbw added a commit that referenced this pull request Jun 26, 2018
@SteveL-MSFT SteveL-MSFT deleted the format-table-right branch October 26, 2018 21:34
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 left aligns header for right aligned column

4 participants