Skip to content

Conversation

@SteveL-MSFT
Copy link
Member

@SteveL-MSFT SteveL-MSFT commented Nov 25, 2019

PR Summary

Currently, the formatter uses WriteLine() on the content expecting it to be not empty. If the custom format explicitly doesn't write anything, it ends up as a newline. Fix is to check that there is something to write, otherwise bail out early. With this change, an empty string still results in a newline, but $null skips writing the newline.

PR Context

Affects a custom formatter I'm writing that requires output to not have trailing newlines.

PR Checklist

@SteveL-MSFT SteveL-MSFT changed the title Update formatter to not write newlines if content is empty WIP: Update formatter to not write newlines if content is empty Nov 26, 2019
@SteveL-MSFT
Copy link
Member Author

This turned out to be a bit more complex than I thought. An empty string represents a newline.

@SteveL-MSFT SteveL-MSFT changed the title WIP: Update formatter to not write newlines if content is empty Update formatter to not write newlines if content is empty Nov 26, 2019
SteveL-MSFT and others added 4 commits November 26, 2019 06:59
@iSazonov iSazonov added the CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log label Nov 27, 2019
@iSazonov iSazonov added this to the 7.1.0-preview.1 milestone Nov 27, 2019
@anmenaga anmenaga merged commit 51d2523 into PowerShell:master Dec 2, 2019
@SteveL-MSFT SteveL-MSFT deleted the empty-formatting branch December 2, 2019 20:20
iSazonov added a commit to iSazonov/PowerShell that referenced this pull request Dec 14, 2019
iSazonov added a commit that referenced this pull request Dec 17, 2019
@ghost
Copy link

ghost commented Mar 26, 2020

🎉v7.1.0-preview.1 has been released which incorporates this pull request.:tada:

Handy links:

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

Labels

CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants