You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I have a console application that sends & receives data from a server. The problem I'm facing is if I want to print the result from the server using AnsiConsole.WriteLine it will write the text on the same line as the prompt from AnsiConsole.AskAsync, for example when the user sends "hello" the server responds with "world":
Here is the AskAsync prompt: hello
Here is the AskAsync prompt: world <-- The response from the server is placed on the same line as the prompt
asd <-- The input itself continues on the next line
Here is the AskAsync prompt: hello
Here is the AskAsync prompt: world
hello
Here is the AskAsync prompt: world
asd
Here is the AskAsync prompt:
I would expect (want) it to look like this:
Here is the AskAsync prompt: hello
world <-- The response from the server is placed on its own line
Here is the AskAsync prompt: asd <-- The input continues on the next line
Here is the AskAsync prompt: hello
world
Here is the AskAsync prompt: hello
world
Here is the AskAsync prompt: asd
Here is the AskAsync prompt:
The code itself boils down to this:
HandleInputAsync();while(true){if(GetServerMessage(outvarmessage)){AnsiConsole.WriteLine(message);}Thread.Sleep(100);}asyncvoidHandleInputAsync(){while(true){varinput=awaitAnsiConsole.AskAsync<string>("Here is the AskAsync prompt:");Send(input);// Send input to server}}
I have tried many things like using cancellation tokens and to no avail, the prompt ("Here is the AskAsync prompt:") still stays before the message and the actual input is placed on a new line without the prompt before it. Is what I'm trying to do possible?
If important, I'm using the default cmd console in Windows 10 (but behaviour is the same in all other consoles I've tested, like GitBash).
P.S. was not sure if I should mark this as a bug since it could be intended.
The text was updated successfully, but these errors were encountered:
Yes, this is not a supported scenario at the moment. AskAsync (and other prompts that accepts input except selection prompts) are not based on a LiveRenderable and therefore cannot be used in this manner.
Hello, I have a console application that sends & receives data from a server. The problem I'm facing is if I want to print the result from the server using
AnsiConsole.WriteLine
it will write the text on the same line as the prompt fromAnsiConsole.AskAsync
, for example when the user sends"hello"
the server responds with"world"
:I would expect (want) it to look like this:
The code itself boils down to this:
I have tried many things like using cancellation tokens and to no avail, the prompt ("Here is the AskAsync prompt:") still stays before the message and the actual input is placed on a new line without the prompt before it. Is what I'm trying to do possible?
If important, I'm using the default
cmd
console in Windows 10 (but behaviour is the same in all other consoles I've tested, like GitBash).P.S. was not sure if I should mark this as a bug since it could be intended.
The text was updated successfully, but these errors were encountered: