From 8cfb6ba58f25d875a2deb4fef06fce99d6e43f9b Mon Sep 17 00:00:00 2001 From: Brian Sutherland Date: Wed, 5 Jan 2022 15:49:15 -0600 Subject: [PATCH 1/2] Remove the EZPZ truncation --- MBBSEmu/HostProcess/ExportedModules/ExportedModuleBase.cs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/MBBSEmu/HostProcess/ExportedModules/ExportedModuleBase.cs b/MBBSEmu/HostProcess/ExportedModules/ExportedModuleBase.cs index 27120f66..7da99b55 100644 --- a/MBBSEmu/HostProcess/ExportedModules/ExportedModuleBase.cs +++ b/MBBSEmu/HostProcess/ExportedModules/ExportedModuleBase.cs @@ -644,10 +644,6 @@ private protected ReadOnlySpan FormatPrintf(ReadOnlySpan stringToPar msFormattedValue.Write(valueCache); } } - - //Need to truncate -- EZPZ - if (msFormattedValue.Length > stringWidth) - msFormattedValue.SetLength(stringWidth); } msOutput.Write(msFormattedValue.ToArray()); continue; From c816ba3bdb77d37fc9a47d8591b3261c6f8ec1fd Mon Sep 17 00:00:00 2001 From: Brian Sutherland Date: Thu, 6 Jan 2022 07:57:35 -0600 Subject: [PATCH 2/2] Added tests to show truncation is not an issue anymore --- MBBSEmu.Tests/ExportedModules/Majorbbs/sprintf_Tests.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MBBSEmu.Tests/ExportedModules/Majorbbs/sprintf_Tests.cs b/MBBSEmu.Tests/ExportedModules/Majorbbs/sprintf_Tests.cs index 58355d66..0de34d69 100644 --- a/MBBSEmu.Tests/ExportedModules/Majorbbs/sprintf_Tests.cs +++ b/MBBSEmu.Tests/ExportedModules/Majorbbs/sprintf_Tests.cs @@ -40,6 +40,8 @@ public class sprintf_Tests : ExportedModuleTestBase [InlineData("%%%%", "%%", null)] //Escaped % [InlineData("%%%%%", "%%%", null)] //Escaped & Unescaped % [InlineData("%%%%% ", "%%% ", null)] //Escaped & Unescaped % + [InlineData("%-8s", "gold crowns", "gold crowns")] + [InlineData("%-8s", "gold ", "gold")] public void sprintf_Test(string formatString, string expectedString, params object[] values) { Reset();