diff --git a/ConsoleInteractive/ConsoleInteractive/ConsoleWriter.cs b/ConsoleInteractive/ConsoleInteractive/ConsoleWriter.cs index d44c7c5..ad52420 100644 --- a/ConsoleInteractive/ConsoleInteractive/ConsoleWriter.cs +++ b/ConsoleInteractive/ConsoleInteractive/ConsoleWriter.cs @@ -36,6 +36,10 @@ public static void WriteLineFormatted(string value) { internal static class InternalWriter { private static void Write(string value) { + int linesAdded = 0; + foreach (string line in value.Split('\n')) + linesAdded += (line.Length / InternalContext.CursorLeftPosLimit) + 1; + lock (InternalContext.WriteLock) { // If the buffer is initialized, then we should get the current cursor position @@ -54,7 +58,6 @@ private static void Write(string value) { ConsoleBuffer.ClearCurrentLine(); Console.WriteLine(value); - int linesAdded = (value.Length / InternalContext.CursorLeftPosLimit) + 1; // Determine if we need to use the previous top position. // i.e. vertically constrained.