Resize with Reflow loses leading spaces on resize operation #1086

Open
opened 2026-01-30 22:16:08 +00:00 by claunia · 0 comments
Owner

Originally created by @miniksa on GitHub (May 14, 2019).

To do this, we need to do #796 first.

This was a customer feedback bug MSFT:16934245. I didn't feel confident touching it because Resize with Reflow is sorta sketchy and was done before we really hit our stride on this project.

Here's the original Repro Steps:

Repro:

  1. Create a new C# console application.

  2. Use Console.WriteLine() to ask the user a question.

  3. Then use the ReadFromConsole_YesNo() method below to ask for a yes or no answer.

  4. Before pressing any key, maximize the console window that gets launched by VS.

ER: Insertion point remains indented by 4 spaces

AR: Insertion point jumps back to start of line

Once we have some actual tests around this, we might be able to dial in the resize with reflow algorithm to handle this better.

   /// <summary>
   /// Continuously reads lines of input from the console until a yes or no answer is received.
   /// Returns true if the read answer was "yes".  Otherwise, false is returned for "no".
   /// </summary>
   static bool ReadFromConsole_YesNo()
   {
       // Keep reading answers from the console until we get a "yes" or "no".
       while (true)
       {
           Console.Write("    "); // Indent input answers for readability
           Console.Out.Flush();
   
           string line = Console.ReadLine().Trim().ToLower(); // Get next answer
   
           // Check if it's a "yes" or "no".
           if      (line.Equals("yes")) {return true;}
           else if (line.Equals("y"))   {return true;}
           else if (line.Equals("no"))  {return false;}
           else if (line.Equals("n"))   {return false;}
       }
   }
Originally created by @miniksa on GitHub (May 14, 2019). To do this, we need to do #796 first. This was a customer feedback bug MSFT:16934245. I didn't feel confident touching it because Resize with Reflow is sorta sketchy and was done before we really hit our stride on this project. Here's the original Repro Steps: > Repro: > > 1. Create a new C# console application. > > 2. Use `Console.WriteLine()` to ask the user a question. > > 3. Then use the `ReadFromConsole_YesNo()` method below to ask for a yes or no answer. > > 4. Before pressing any key, maximize the console window that gets launched by VS. > > > > ER: Insertion point remains indented by 4 spaces > > AR: Insertion point jumps back to start of line Once we have some actual tests around this, we might be able to dial in the resize with reflow algorithm to handle this better. > ```c# > /// <summary> > /// Continuously reads lines of input from the console until a yes or no answer is received. > /// Returns true if the read answer was "yes". Otherwise, false is returned for "no". > /// </summary> > static bool ReadFromConsole_YesNo() > { > // Keep reading answers from the console until we get a "yes" or "no". > while (true) > { > Console.Write(" "); // Indent input answers for readability > Console.Out.Flush(); > > string line = Console.ReadLine().Trim().ToLower(); // Get next answer > > // Check if it's a "yes" or "no". > if (line.Equals("yes")) {return true;} > else if (line.Equals("y")) {return true;} > else if (line.Equals("no")) {return false;} > else if (line.Equals("n")) {return false;} > } > } > ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#1086