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
|
try
|
||||||
{
|
{
|
||||||
if (Console.CursorLeft == 0)
|
GoBack();
|
||||||
{
|
Console.Write(' ');
|
||||||
Console.CursorLeft = Console.BufferWidth - 1;
|
GoBack();
|
||||||
if (Console.CursorTop > 0)
|
|
||||||
Console.CursorTop--;
|
|
||||||
Console.Write(' ');
|
|
||||||
Console.CursorLeft = Console.BufferWidth - 1;
|
|
||||||
if (Console.CursorTop > 0)
|
|
||||||
Console.CursorTop--;
|
|
||||||
}
|
|
||||||
else Console.Write("\b \b");
|
|
||||||
}
|
}
|
||||||
catch (ArgumentOutOfRangeException) { /* Console was resized!? */ }
|
catch (ArgumentOutOfRangeException) { /* Console was resized!? */ }
|
||||||
buffer = buffer.Substring(0, buffer.Length - 1);
|
buffer = buffer.Substring(0, buffer.Length - 1);
|
||||||
|
|
||||||
if (buffer2.Length > 0)
|
if (buffer2.Length > 0)
|
||||||
{
|
{
|
||||||
Console.Write(buffer2 + " \b");
|
Console.Write(buffer2);
|
||||||
|
Console.Write(' ');
|
||||||
|
GoBack();
|
||||||
for (int i = 0; i < buffer2.Length; i++)
|
for (int i = 0; i < buffer2.Length; i++)
|
||||||
{
|
{
|
||||||
GoBack();
|
GoBack();
|
||||||
|
|
@ -457,7 +451,10 @@ namespace MinecraftClient
|
||||||
if (Console.CursorTop > 0)
|
if (Console.CursorTop > 0)
|
||||||
Console.CursorTop--;
|
Console.CursorTop--;
|
||||||
}
|
}
|
||||||
else Console.Write('\b');
|
else
|
||||||
|
{
|
||||||
|
Console.CursorLeft = Console.CursorLeft - 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (ArgumentOutOfRangeException) { /* Console was resized!? */ }
|
catch (ArgumentOutOfRangeException) { /* Console was resized!? */ }
|
||||||
}
|
}
|
||||||
|
|
@ -471,7 +468,7 @@ namespace MinecraftClient
|
||||||
{
|
{
|
||||||
buffer2 = "" + buffer[buffer.Length - 1] + buffer2;
|
buffer2 = "" + buffer[buffer.Length - 1] + buffer2;
|
||||||
buffer = buffer.Substring(0, buffer.Length - 1);
|
buffer = buffer.Substring(0, buffer.Length - 1);
|
||||||
Console.Write('\b');
|
GoBack();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -288,10 +288,10 @@ would not have been possible without the help of talented contributors:
|
||||||
|
|
||||||
**Bug Hunters:**
|
**Bug Hunters:**
|
||||||
|
|
||||||
1092CQ, ambysdotnet, bearbear12345, c0dei, Cat7373, Darkaegis, dbear20, DigitalSniperz,
|
1092CQ, ambysdotnet, bearbear12345, c0dei, Cat7373, Chtholly, Darkaegis, dbear20,
|
||||||
doranchak, drXor, FantomHD, gerik43, ibspa, iTzMrpitBull, JamieSinn, k3ldon, KenXeiko,
|
DigitalSniperz, doranchak, drXor, FantomHD, gerik43, ibspa, iTzMrpitBull, JamieSinn,
|
||||||
link3321, lyze237, mattman00000, Nicconyancat, Pokechu22, ridgewell, Ryan6578, Solethia,
|
k3ldon, KenXeiko, link3321, lyze237, mattman00000, Nicconyancat, Pokechu22, ridgewell,
|
||||||
TNT-UP, TorchRJ, TRTrident, WeedIsGood, xp9kus, Yoann166
|
Ryan6578, Solethia, TNT-UP, TorchRJ, TRTrident, WeedIsGood, xp9kus, Yoann166
|
||||||
|
|
||||||
**Code contributions:**
|
**Code contributions:**
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue