-
Notifications
You must be signed in to change notification settings - Fork 67
Fixed #58 - Newlines in commands render incorrectly #60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
6af1903
a69373e
f155262
440833e
dd2e765
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -164,6 +164,12 @@ private static string GetPaddedString(List<string> strings, int[] colWidths, int | |||||||
builder.Append(' '); | ||||||||
} | ||||||||
|
||||||||
// Replace any newlines with encoded newline/linefeed (`n or `r) | ||||||||
// Note we can't use Environment.Newline because we don't know that the | ||||||||
// Command honors that. | ||||||||
strings[i] = strings[i].Replace("\r", "`r"); | ||||||||
strings[i] = strings[i].Replace("\n", "`n"); | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So thinking about this some more, it may be possible that the string has a carriage return and a linefeed. So in addition to what you're doing here, we should also handle that so:
Suggested change
This makes sure there are no lingering There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would it be just as good to do a replace for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah that's true. I guess that would catch the off chance that there's a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I concur. I've changed it to: // Replace any newlines with encoded newline/linefeed (`n or `r)
// Note we can't use Environment.Newline because we don't know that the
// Command honors that.
strings[i] = strings[i].Replace("\r", "`r");
strings[i] = strings[i].Replace("\n", "`n"); I don't do many PRs, so I'm not sure what I'm supposed to do to push this through other than pushing it to my There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You should create new branch for every new PR. |
||||||||
|
||||||||
// If the string won't fit in the column, append an ellipsis. | ||||||||
if (strings[i].Length > colWidths[i]) | ||||||||
{ | ||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you so much for this!!