mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Indentation change for Fix concurrency[..]
Indentation was intentionally left the same in previous commit for clearer diff, this commit only fixes code indentation from last commit
This commit is contained in:
parent
3376247826
commit
33b84584aa
1 changed files with 107 additions and 107 deletions
|
|
@ -110,87 +110,87 @@ namespace MinecraftClient
|
||||||
k = Console.ReadKey(true);
|
k = Console.ReadKey(true);
|
||||||
lock (io_lock)
|
lock (io_lock)
|
||||||
{
|
{
|
||||||
if (k.Key == ConsoleKey.V && k.Modifiers == ConsoleModifiers.Control)
|
if (k.Key == ConsoleKey.V && k.Modifiers == ConsoleModifiers.Control)
|
||||||
{
|
|
||||||
string clip = ReadClipboard();
|
|
||||||
foreach (char c in clip)
|
|
||||||
AddChar(c);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
switch (k.Key)
|
|
||||||
{
|
{
|
||||||
case ConsoleKey.Escape:
|
string clip = ReadClipboard();
|
||||||
ClearLineAndBuffer();
|
foreach (char c in clip)
|
||||||
break;
|
AddChar(c);
|
||||||
case ConsoleKey.Backspace:
|
}
|
||||||
RemoveOneChar();
|
else
|
||||||
break;
|
{
|
||||||
case ConsoleKey.Enter:
|
switch (k.Key)
|
||||||
Console.Write('\n');
|
{
|
||||||
break;
|
case ConsoleKey.Escape:
|
||||||
case ConsoleKey.LeftArrow:
|
ClearLineAndBuffer();
|
||||||
GoLeft();
|
break;
|
||||||
break;
|
case ConsoleKey.Backspace:
|
||||||
case ConsoleKey.RightArrow:
|
|
||||||
GoRight();
|
|
||||||
break;
|
|
||||||
case ConsoleKey.Home:
|
|
||||||
while (buffer.Length > 0) { GoLeft(); }
|
|
||||||
break;
|
|
||||||
case ConsoleKey.End:
|
|
||||||
while (buffer2.Length > 0) { GoRight(); }
|
|
||||||
break;
|
|
||||||
case ConsoleKey.Delete:
|
|
||||||
if (buffer2.Length > 0)
|
|
||||||
{
|
|
||||||
GoRight();
|
|
||||||
RemoveOneChar();
|
RemoveOneChar();
|
||||||
}
|
break;
|
||||||
break;
|
case ConsoleKey.Enter:
|
||||||
case ConsoleKey.Oem6:
|
Console.Write('\n');
|
||||||
break;
|
break;
|
||||||
case ConsoleKey.DownArrow:
|
case ConsoleKey.LeftArrow:
|
||||||
if (previous.Count > 0)
|
GoLeft();
|
||||||
{
|
break;
|
||||||
ClearLineAndBuffer();
|
case ConsoleKey.RightArrow:
|
||||||
buffer = previous.First.Value;
|
GoRight();
|
||||||
previous.AddLast(buffer);
|
break;
|
||||||
previous.RemoveFirst();
|
case ConsoleKey.Home:
|
||||||
Console.Write(buffer);
|
while (buffer.Length > 0) { GoLeft(); }
|
||||||
}
|
break;
|
||||||
break;
|
case ConsoleKey.End:
|
||||||
case ConsoleKey.UpArrow:
|
while (buffer2.Length > 0) { GoRight(); }
|
||||||
if (previous.Count > 0)
|
break;
|
||||||
{
|
case ConsoleKey.Delete:
|
||||||
ClearLineAndBuffer();
|
if (buffer2.Length > 0)
|
||||||
buffer = previous.Last.Value;
|
|
||||||
previous.AddFirst(buffer);
|
|
||||||
previous.RemoveLast();
|
|
||||||
Console.Write(buffer);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case ConsoleKey.Tab:
|
|
||||||
if (autocomplete_engine != null && buffer.Length > 0)
|
|
||||||
{
|
|
||||||
string[] tmp = buffer.Split(' ');
|
|
||||||
if (tmp.Length > 0)
|
|
||||||
{
|
{
|
||||||
string word_tocomplete = tmp[tmp.Length - 1];
|
GoRight();
|
||||||
string word_autocomplete = autocomplete_engine.AutoComplete(buffer);
|
RemoveOneChar();
|
||||||
if (!String.IsNullOrEmpty(word_autocomplete) && word_autocomplete != word_tocomplete)
|
}
|
||||||
|
break;
|
||||||
|
case ConsoleKey.Oem6:
|
||||||
|
break;
|
||||||
|
case ConsoleKey.DownArrow:
|
||||||
|
if (previous.Count > 0)
|
||||||
|
{
|
||||||
|
ClearLineAndBuffer();
|
||||||
|
buffer = previous.First.Value;
|
||||||
|
previous.AddLast(buffer);
|
||||||
|
previous.RemoveFirst();
|
||||||
|
Console.Write(buffer);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ConsoleKey.UpArrow:
|
||||||
|
if (previous.Count > 0)
|
||||||
|
{
|
||||||
|
ClearLineAndBuffer();
|
||||||
|
buffer = previous.Last.Value;
|
||||||
|
previous.AddFirst(buffer);
|
||||||
|
previous.RemoveLast();
|
||||||
|
Console.Write(buffer);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ConsoleKey.Tab:
|
||||||
|
if (autocomplete_engine != null && buffer.Length > 0)
|
||||||
|
{
|
||||||
|
string[] tmp = buffer.Split(' ');
|
||||||
|
if (tmp.Length > 0)
|
||||||
{
|
{
|
||||||
while (buffer.Length > 0 && buffer[buffer.Length - 1] != ' ') { RemoveOneChar(); }
|
string word_tocomplete = tmp[tmp.Length - 1];
|
||||||
foreach (char c in word_autocomplete) { AddChar(c); }
|
string word_autocomplete = autocomplete_engine.AutoComplete(buffer);
|
||||||
|
if (!String.IsNullOrEmpty(word_autocomplete) && word_autocomplete != word_tocomplete)
|
||||||
|
{
|
||||||
|
while (buffer.Length > 0 && buffer[buffer.Length - 1] != ' ') { RemoveOneChar(); }
|
||||||
|
foreach (char c in word_autocomplete) { AddChar(c); }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
break;
|
||||||
break;
|
default:
|
||||||
default:
|
if (k.KeyChar != 0)
|
||||||
if (k.KeyChar != 0)
|
AddChar(k.KeyChar);
|
||||||
AddChar(k.KeyChar);
|
break;
|
||||||
break;
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -213,40 +213,40 @@ namespace MinecraftClient
|
||||||
{
|
{
|
||||||
lock (io_lock)
|
lock (io_lock)
|
||||||
{
|
{
|
||||||
if (reading)
|
if (reading)
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
string buf = buffer;
|
|
||||||
string buf2 = buffer2;
|
|
||||||
ClearLineAndBuffer();
|
|
||||||
if (Console.CursorLeft == 0)
|
|
||||||
{
|
{
|
||||||
Console.CursorLeft = Console.BufferWidth - 1;
|
try
|
||||||
Console.CursorTop--;
|
{
|
||||||
Console.Write(' ');
|
string buf = buffer;
|
||||||
Console.CursorLeft = Console.BufferWidth - 1;
|
string buf2 = buffer2;
|
||||||
Console.CursorTop--;
|
ClearLineAndBuffer();
|
||||||
|
if (Console.CursorLeft == 0)
|
||||||
|
{
|
||||||
|
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(); }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (ArgumentOutOfRangeException)
|
||||||
|
{
|
||||||
|
//Console resized: Try again
|
||||||
|
Console.Write('\n');
|
||||||
|
Write(text);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else Console.Write("\b \b");
|
else Console.Write(text);
|
||||||
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(); }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (ArgumentOutOfRangeException)
|
|
||||||
{
|
|
||||||
//Console resized: Try again
|
|
||||||
Console.Write('\n');
|
|
||||||
Write(text);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else Console.Write(text);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else Console.Write(text);
|
else Console.Write(text);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue