Skip to content

Resize with Reflow loses leading spaces on resize operation #797

@miniksa

Description

@miniksa

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;}
       }
   }

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-InteractionInteracting with the vintage console window (as opposed to driving via API or hooks)In-PRThis issue has a related PRIssue-BugIt either shouldn't be doing this or needs an investigation.Needs-Tag-FixDoesn't match tag requirementsPriority-2A description (P2)Product-ConhostFor issues in the Console codebase

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions