❔ CMD Causing Problems with Custom Input Class

I am working on a C# project that takes input from the user from CMD, and because I like my software to run a specific way I made my own Input Class. It adds a few things that the normal Console.ReadLine() does not include, like command histories and such. On Mac it runs perfectly, but I have not gotten it to work on windows because of a bothersome issue. With CMD while using the Console.ReadKey() and looping over it like this:
string input = "";
while (true)
{
input += Console.ReadKey().Key.ToString();
}
string input = "";
while (true)
{
input += Console.ReadKey().Key.ToString();
}
When you press backspace it moves the cursor over to the left one. I have noticed a few small issues like this, making getting CMD support difficult. My question is, is there a way to disable these shortcuts and just get the key input?
8 Replies
𝒲𝒾𝒢𝓏𝒢𝓇𝓇
That is the function I am using, that is causing the weird backspace issue
Jimmacle
Jimmacleβ€’11mo ago
it doesn't look like you're using it with the argument that suppresses the default key handling
𝒲𝒾𝒢𝓏𝒢𝓇𝓇
The only argument that Im seeing on this page is the "intercept" argument and from the website it says this argument: "Determines whether to display the pressed key in the console window. true to not display the pressed key; otherwise, false".
Jimmacle
Jimmacleβ€’11mo ago
yes did you try it?
𝒲𝒾𝒢𝓏𝒢𝓇𝓇
Yes sorry, There was a different bug that made it look like it didn't work thank you for the help!
Jimmacle
Jimmacleβ€’11mo ago
pepeok
Accord
Accordβ€’11mo ago
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server
More Posts