Compare commits

..

2 Commits
1.6.0 ... 1.6.1

Author SHA1 Message Date
Matt Nadareski
10eecc866e Bump version 2024-12-05 22:11:48 -05:00
Matt Nadareski
84fa2f93ea Fix consecutive empty line logic 2024-12-05 21:15:26 -05:00
3 changed files with 12 additions and 12 deletions

View File

@@ -848,25 +848,25 @@ namespace SabreTools.RedumpLib.Test
#endregion
#region RemoveConsecutiveNewlines
#region RemoveConsecutiveEmptyLines
[Fact]
public void RemoveConsecutiveNewlines_Linux_Removed()
public void RemoveConsecutiveEmptyLines_Linux_Removed()
{
string expected = "data\nbase";
string expected = "data\n\nbase";
string newlines = "data\n\n\n\n\n\n\n\n\n\nbase";
string actual = Formatter.RemoveConsecutiveNewlines(newlines);
string actual = Formatter.RemoveConsecutiveEmptyLines(newlines);
Assert.Equal(expected, actual);
}
[Fact]
public void RemoveConsecutiveNewlines_Windows_Removed()
public void RemoveConsecutiveEmptyLines_Windows_Removed()
{
string expected = "data\r\nbase";
string expected = "data\r\n\r\nbase";
string newlines = "data\r\n\r\n\r\n\r\n\r\nbase";
string actual = Formatter.RemoveConsecutiveNewlines(newlines);
string actual = Formatter.RemoveConsecutiveEmptyLines(newlines);
Assert.Equal(expected, actual);
}

View File

@@ -175,7 +175,7 @@ namespace SabreTools.RedumpLib
status = "Formatting complete!";
// Make sure there aren't any instances of two blank lines in a row
return RemoveConsecutiveNewlines(output.ToString());
return RemoveConsecutiveEmptyLines(output.ToString());
}
catch (Exception ex)
{
@@ -754,10 +754,10 @@ namespace SabreTools.RedumpLib
/// <summary>
/// Make sure there aren't any instances of two blank lines in a row
/// </summary>
internal static string RemoveConsecutiveNewlines(string str)
internal static string RemoveConsecutiveEmptyLines(string str)
{
str = Regex.Replace(str, @"(\r\n)+", "\r\n");
return Regex.Replace(str, @"(\n)+", "\n");
str = Regex.Replace(str, @"(\r\n){2,}", "\r\n\r\n");
return Regex.Replace(str, @"(\n){2,}", "\n\n");
}
#endregion

View File

@@ -6,7 +6,7 @@
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<Version>1.6.0</Version>
<Version>1.6.1</Version>
<!-- Package Properties -->
<Authors>Matt Nadareski</Authors>