Skip to content

Format-Table left aligns header for right aligned column #7078

Closed

Description

Steps to reproduce

class X {	
	[string] $s
	[int] $I
}

[X] @{
	I = 1123098
	S = "Text"
}

Expected behavior

s          I
-          -
Text 1123098

Actual behavior

s    I
-          -
Text 1123098

Environment data

Name                           Value
----                           -----
PSVersion                      6.1.0-preview.3
PSEdition                      Core
GitCommitId                    v6.1.0-preview.3
OS                             Microsoft Windows 10.0.16299
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

This does not happen on Windows PowerShell 5.1 or pwsh 6.0.2.

Activity

  1. changed the title [-]FormatTable left aligns header for right aligned column[/-] [+]Format-Table left aligns header for right aligned column[/+] on Jun 15, 2018
  2. powercode commented on Jun 18, 2018

    @powercode
    CollaboratorAuthor

    I think the problem only manifest when the right aligned item is the last column. In an effort to get rid of the padding at the end of the row, I think we might have gotten rid of the right-alignment padding.

    Steve Lee (@SteveL-MSFT) Do you recognize any of this from your table formatting changes?

    I think addPadding here


    should only be set if we are not right aligned.

  3. SteveL-MSFT commented on Jun 18, 2018

    @SteveL-MSFT
    Member

    Staffan Gustafsson (@powercode) I think you're right. Ilya (@iSazonov) and I added more tests to Format-Table.Tests.ps1, but it looks like we missed cases where the header is shorter than the width.

    Are you planning on submitting a PR?

  4. added
    Issue-Bug
    WG-Engine
    on Jun 18, 2018
  5. powercode commented on Jun 18, 2018

    @powercode
    CollaboratorAuthor

    I have other things I should catch up with first, but I think we should fix this before releasing.

  6. SteveL-MSFT commented on Jun 18, 2018

    @SteveL-MSFT
    Member

    Staffan Gustafsson (@powercode) no problem, I'll see about looking at this after my current PRs, just didn't want to work on it if you were going to.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Issue-BugResolution-FixedWG-Engine

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions