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:
ORelio 2020-04-15 14:51:53 +02:00
parent 0acb17e105
commit e4cae97dd7
2 changed files with 15 additions and 18 deletions

View file

@ -418,24 +418,18 @@ namespace MinecraftClient
{
try
{
if (Console.CursorLeft == 0)
{
Console.CursorLeft = Console.BufferWidth - 1;
if (Console.CursorTop > 0)
Console.CursorTop--;
GoBack();
Console.Write(' ');
Console.CursorLeft = Console.BufferWidth - 1;
if (Console.CursorTop > 0)
Console.CursorTop--;
}
else Console.Write("\b \b");
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();
}
}

View file

@ -288,10 +288,10 @@ would not have been possible without the help of talented contributors:
**Bug Hunters:**
1092CQ, ambysdotnet, bearbear12345, c0dei, Cat7373, Darkaegis, dbear20, DigitalSniperz,
doranchak, drXor, FantomHD, gerik43, ibspa, iTzMrpitBull, JamieSinn, k3ldon, KenXeiko,
link3321, lyze237, mattman00000, Nicconyancat, Pokechu22, ridgewell, Ryan6578, Solethia,
TNT-UP, TorchRJ, TRTrident, WeedIsGood, xp9kus, Yoann166
1092CQ, ambysdotnet, bearbear12345, c0dei, Cat7373, Chtholly, Darkaegis, dbear20,
DigitalSniperz, doranchak, drXor, FantomHD, gerik43, ibspa, iTzMrpitBull, JamieSinn,
k3ldon, KenXeiko, link3321, lyze237, mattman00000, Nicconyancat, Pokechu22, ridgewell,
Ryan6578, Solethia, TNT-UP, TorchRJ, TRTrident, WeedIsGood, xp9kus, Yoann166
**Code contributions:**