Reputation: 12249
I know how to set the cursor position of the console, but upon creating a new line, the cursor moves back to the left side of the console.
How do I set the cursor position and write multiple lines while retaining the cursor's x
coordinate?
Note: It is note an option for me to set the cursor position for every line, as my block of text changes size often.
Upvotes: 2
Views: 668
Reputation: 292465
void WriteLineKeepingIndent(string format, params object[] args)
{
int x = Console.CursorLeft;
Console.WriteLine(format, args);
Console.CursorLeft = x;
}
Upvotes: 5
Reputation: 1442
You should use one of
Upvotes: 0