mirror of
https://github.com/SabreTools/SabreTools.CommandLine.git
synced 2026-09-22 06:35:32 +00:00
Fix formatting irregularities with spaces
This commit is contained in:
@@ -109,6 +109,7 @@ namespace SabreTools.CommandLine.Test
|
||||
[InlineData("Some long description\nwith a newline", 3)]
|
||||
[InlineData("Some long description\nwith\nmultiple\nnewlines", 5)]
|
||||
[InlineData("Some long description\n - With formatting", 3)]
|
||||
[InlineData("Some long description with multiple spaces", 2)]
|
||||
public void FormatLongDescriptionTest(string longDescription, int expectedCount)
|
||||
{
|
||||
var feature = new MockFeature("a", "a", "a", longDescription);
|
||||
|
||||
@@ -710,7 +710,7 @@ namespace SabreTools.CommandLine.Inputs
|
||||
|
||||
// Normalize the description for output
|
||||
string longDescription = _longDescription!.Replace("\r\n", "\n");
|
||||
longDescription = longDescription.Replace("\n", "\n" + CreatePadding(pre + 4));
|
||||
longDescription = longDescription.Replace("\n", "\n ");
|
||||
|
||||
// Get the width of the console for wrapping reference
|
||||
int width = (Console.WindowWidth == 0 ? 80 : Console.WindowWidth) - 1;
|
||||
@@ -727,7 +727,14 @@ namespace SabreTools.CommandLine.Inputs
|
||||
// Cache the current segment
|
||||
string segment = split[i];
|
||||
|
||||
// If we have a newline character, reset the line and continue
|
||||
// If the segment is empty
|
||||
if (segment.Length == 0)
|
||||
{
|
||||
output.Append(" ");
|
||||
continue;
|
||||
}
|
||||
|
||||
// If the line ends with a newline
|
||||
bool forceSplit = false;
|
||||
if (segment.EndsWith("\n"))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user