diff --git a/SabreTools.CommandLine.Test/FeatureTests.cs b/SabreTools.CommandLine.Test/FeatureTests.cs index 848d9c9..465ef2d 100644 --- a/SabreTools.CommandLine.Test/FeatureTests.cs +++ b/SabreTools.CommandLine.Test/FeatureTests.cs @@ -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); diff --git a/SabreTools.CommandLine/Inputs/UserInput.cs b/SabreTools.CommandLine/Inputs/UserInput.cs index ea466ae..1dc4709 100644 --- a/SabreTools.CommandLine/Inputs/UserInput.cs +++ b/SabreTools.CommandLine/Inputs/UserInput.cs @@ -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")) {