mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
ConsoleIO: Rewrite backspace handling
Manually move the cursor instead of using the backspace character. Should help when deleting characters requiring multiple keypresses like Chinese characters. Fix attempt for #941
This commit is contained in:
parent
0acb17e105
commit
e4cae97dd7
2 changed files with 15 additions and 18 deletions
|
|
@ -418,24 +418,18 @@ namespace MinecraftClient
|
|||
{
|
||||
try
|
||||
{
|
||||
if (Console.CursorLeft == 0)
|
||||
{
|
||||
Console.CursorLeft = Console.BufferWidth - 1;
|
||||
if (Console.CursorTop > 0)
|
||||
Console.CursorTop--;
|
||||
Console.Write(' ');
|
||||
Console.CursorLeft = Console.BufferWidth - 1;
|
||||
if (Console.CursorTop > 0)
|
||||
Console.CursorTop--;
|
||||
}
|
||||
else Console.Write("\b \b");
|
||||
GoBack();
|
||||
Console.Write(' ');
|
||||
GoBack();
|
||||
}
|
||||
catch (ArgumentOutOfRangeException) { /* Console was resized!? */ }
|
||||
buffer = buffer.Substring(0, buffer.Length - 1);
|
||||
|
||||
if (buffer2.Length > 0)
|
||||
{
|
||||
Console.Write(buffer2 + " \b");
|
||||
Console.Write(buffer2);
|
||||
Console.Write(' ');
|
||||
GoBack();
|
||||
for (int i = 0; i < buffer2.Length; i++)
|
||||
{
|
||||
GoBack();
|
||||
|
|
@ -457,7 +451,10 @@ namespace MinecraftClient
|
|||
if (Console.CursorTop > 0)
|
||||
Console.CursorTop--;
|
||||
}
|
||||
else Console.Write('\b');
|
||||
else
|
||||
{
|
||||
Console.CursorLeft = Console.CursorLeft - 1;
|
||||
}
|
||||
}
|
||||
catch (ArgumentOutOfRangeException) { /* Console was resized!? */ }
|
||||
}
|
||||
|
|
@ -471,7 +468,7 @@ namespace MinecraftClient
|
|||
{
|
||||
buffer2 = "" + buffer[buffer.Length - 1] + buffer2;
|
||||
buffer = buffer.Substring(0, buffer.Length - 1);
|
||||
Console.Write('\b');
|
||||
GoBack();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue