mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-11-07 17:36:07 +00:00
Fix crash when resizing terminal
Bug report by doranchak
This commit is contained in:
parent
ea17ec87f1
commit
2cf46c0487
1 changed files with 27 additions and 17 deletions
|
|
@ -193,26 +193,36 @@ namespace MinecraftClient
|
||||||
writing_lock = true;
|
writing_lock = true;
|
||||||
if (reading)
|
if (reading)
|
||||||
{
|
{
|
||||||
string buf = buffer;
|
try
|
||||||
string buf2 = buffer2;
|
|
||||||
ClearLineAndBuffer();
|
|
||||||
if (Console.CursorLeft == 0)
|
|
||||||
{
|
{
|
||||||
Console.CursorLeft = Console.BufferWidth - 1;
|
string buf = buffer;
|
||||||
Console.CursorTop--;
|
string buf2 = buffer2;
|
||||||
Console.Write(' ');
|
ClearLineAndBuffer();
|
||||||
Console.CursorLeft = Console.BufferWidth - 1;
|
if (Console.CursorLeft == 0)
|
||||||
Console.CursorTop--;
|
{
|
||||||
|
Console.CursorLeft = Console.BufferWidth - 1;
|
||||||
|
Console.CursorTop--;
|
||||||
|
Console.Write(' ');
|
||||||
|
Console.CursorLeft = Console.BufferWidth - 1;
|
||||||
|
Console.CursorTop--;
|
||||||
|
}
|
||||||
|
else Console.Write("\b \b");
|
||||||
|
Console.Write(text);
|
||||||
|
buffer = buf;
|
||||||
|
buffer2 = buf2;
|
||||||
|
Console.Write(">" + buffer);
|
||||||
|
if (buffer2.Length > 0)
|
||||||
|
{
|
||||||
|
Console.Write(buffer2 + " \b");
|
||||||
|
for (int i = 0; i < buffer2.Length; i++) { GoBack(); }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else Console.Write("\b \b");
|
catch (ArgumentOutOfRangeException)
|
||||||
Console.Write(text);
|
|
||||||
buffer = buf;
|
|
||||||
buffer2 = buf2;
|
|
||||||
Console.Write(">" + buffer);
|
|
||||||
if (buffer2.Length > 0)
|
|
||||||
{
|
{
|
||||||
Console.Write(buffer2 + " \b");
|
//Console resized: Try again
|
||||||
for (int i = 0; i < buffer2.Length; i++) { GoBack(); }
|
Console.Write('\n');
|
||||||
|
writing_lock = false;
|
||||||
|
Write(text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else Console.Write(text);
|
else Console.Write(text);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue