diff --git a/AvaloniaIDemo/KirejeharbearkiqaHawhulearkemhaikerewear/SshCore/Program.cs b/AvaloniaIDemo/KirejeharbearkiqaHawhulearkemhaikerewear/SshCore/Program.cs index f6cf01009..836e91797 100644 --- a/AvaloniaIDemo/KirejeharbearkiqaHawhulearkemhaikerewear/SshCore/Program.cs +++ b/AvaloniaIDemo/KirejeharbearkiqaHawhulearkemhaikerewear/SshCore/Program.cs @@ -15,11 +15,36 @@ internal class Program { static async Task Main(string[] args) { - Console.Write("123"); + var currentLine = new StringBuilder(); + bool isSendTab = false; + while (true) { var consoleKeyInfo = Console.ReadKey(true); - Console.Read(); + + if (consoleKeyInfo.Key == ConsoleKey.Escape) + { + break; + } + + if (consoleKeyInfo.Key == ConsoleKey.Tab) + { + isSendTab = true; + } + else if (consoleKeyInfo.Key == ConsoleKey.Backspace) + { + currentLine.Remove(currentLine.Length - 1, 1); + //Console.Write('\b'); + //continue; + } + else + { + currentLine.Append(consoleKeyInfo.KeyChar); + } + + Console.CursorLeft = 0; + Console.Write($"\r{currentLine.ToString()}"); + //consoleKeyInfo.KeyChar } @@ -47,6 +72,8 @@ static async Task Main(string[] args) Console.WriteLine($"[SSH] {message}"); }; + + while (true) { var line = Console.ReadLine();