Skip to content

Fix table format not adding padding for right justified column - #7136

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

Fix table format not adding padding for right justified column#7136
Ilya (iSazonov) merged 1 commit into
PowerShell:masterfrom
SteveL-MSFT:format-table-right

Conversation

@SteveL-MSFT

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

Copy link
Copy Markdown
Member

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
Copy Markdown
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
Copy Markdown
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.

Copy link
Copy Markdown

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
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

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


a b
- -
123 abc

Copy link
Copy Markdown

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
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@iSazonov
Ilya (iSazonov) merged commit e8d2a6b into PowerShell:master Jun 26, 2018
Dongbo Wang (daxian-dbw) added a commit that referenced this pull request Jun 26, 2018
@SteveL-MSFT
Steve Lee (SteveL-MSFT) deleted the format-table-right branch October 26, 2018 21:34
Thatgfsj (Thatgfsj) pushed a commit to Thatgfsj-contribs/PowerShell that referenced this pull request Aug 6, 2026
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).
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