now accomodates for whatever was already on the line.

This commit is contained in:
Harrison Deng 2018-12-09 01:10:42 -06:00
parent c95835ac3d
commit 1e5aab564e

View File

@ -15,12 +15,12 @@ namespace RecrownedAthenaeum.Tools
public static string WrapMessageToConsoleWidth(string message)
{
string[] words = message.Replace("\t", "").Split(' ');
string[] words = message.Split(' ');
StringBuilder stringBuilder = new StringBuilder();
int currentLineSize = 0;
for (int i = 0; i < words.Length; i++)
{
if (currentLineSize + words[i].Length >= Console.BufferWidth)
if (currentLineSize + words[i].Length >= Console.BufferWidth - Console.CursorLeft)
{
currentLineSize = 0;
stringBuilder.AppendLine();