Properly ignore control characters when adding input in CLI and Terminal processes

This commit is contained in:
Stone_Red
2026-06-10 03:03:28 +02:00
parent f2fd0d9c91
commit 98e4f73cfe
2 changed files with 6 additions and 3 deletions
+5 -2
View File
@@ -41,8 +41,11 @@ internal class CliProcess() : Process("Cli")
break;
default:
currentInput += key.KeyChar;
Console.Write(key.KeyChar);
if (!char.IsControl(key.KeyChar))
{
currentInput += key.KeyChar;
Console.Write(key.KeyChar);
}
break;
}
}
+1 -1
View File
@@ -81,7 +81,7 @@ public class TerminalProcess : Process
UpdateDisplay();
}
}
else if (keyEvent.KeyChar is >= (char)32 and <= (char)126) // Printable chars
else if (!char.IsControl(keyEvent.KeyChar))
{
currentInput += keyEvent.KeyChar;
UpdateDisplay();