now accomodates for whatever was already on the line.
This commit is contained in:
parent
c95835ac3d
commit
1e5aab564e
@ -15,12 +15,12 @@ namespace RecrownedAthenaeum.Tools
|
|||||||
|
|
||||||
public static string WrapMessageToConsoleWidth(string message)
|
public static string WrapMessageToConsoleWidth(string message)
|
||||||
{
|
{
|
||||||
string[] words = message.Replace("\t", "").Split(' ');
|
string[] words = message.Split(' ');
|
||||||
StringBuilder stringBuilder = new StringBuilder();
|
StringBuilder stringBuilder = new StringBuilder();
|
||||||
int currentLineSize = 0;
|
int currentLineSize = 0;
|
||||||
for (int i = 0; i < words.Length; i++)
|
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;
|
currentLineSize = 0;
|
||||||
stringBuilder.AppendLine();
|
stringBuilder.AppendLine();
|
||||||
|
Loading…
Reference in New Issue
Block a user