Skip to content

Commit

Permalink
似乎无法干掉退格
Browse files Browse the repository at this point in the history
  • Loading branch information
lindexi committed Oct 12, 2024
1 parent 2f14505 commit 8c8feaa
Showing 1 changed file with 29 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
}


Expand Down Expand Up @@ -47,6 +72,8 @@ static async Task Main(string[] args)
Console.WriteLine($"[SSH] {message}");
};



while (true)
{
var line = Console.ReadLine();
Expand Down

0 comments on commit 8c8feaa

Please sign in to comment.