From 167c79edba86a441dfed67fc3d9676fd2d57264b Mon Sep 17 00:00:00 2001 From: Steve Lee Date: Mon, 27 Feb 2023 22:14:39 -0800 Subject: [PATCH] Fix VtSubstring helper method to correctly check chars copied --- src/System.Management.Automation/utils/StringUtil.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/System.Management.Automation/utils/StringUtil.cs b/src/System.Management.Automation/utils/StringUtil.cs index 6bdedd03a3b..8daf31866df 100644 --- a/src/System.Management.Automation/utils/StringUtil.cs +++ b/src/System.Management.Automation/utils/StringUtil.cs @@ -202,7 +202,7 @@ internal static string VtSubstring(this string str, int startOffset, int length, } // If the number of copied non-escape-sequence characters has reached the specified length, done copying. - if (offset == length) + if (copyStarted && offset == length) { break; }