Newline Handling of [Microsoft.PowerShell.PSConsoleReadLine]::Insert broken in Windows #3939
Open
3 tasks done
Labels
Issue-Bug
It either shouldn't be doing this or needs an investigation.
Prerequisites
Exception report
N/A
Screenshot
Environment data
Steps to reproduce
I've developed a module (CmdFav) which inserts commands into the NEXT prompt. If the command is a multiline command the command string is internally build with StringBuilder.AppendLine(). StringBuilder is using Windows' carriage return + new line (`r`n) instead of just new line (`n). This causes PSConsoleReadLine::Insert to insert visible ^M characters (orange arrow in screenshot) and moves the cursor additional lines to low (red marker in screenshot).
Code to reproduce:
The 'too low cursor' prevents the user to modify the code which is inserted into the prompt in the blank space. If I move the cursor into the blank space and (e.g.) press
+
the real code is shown, interrupted by the+
char.Expected behavior
Actual behavior
^M
The text was updated successfully, but these errors were encountered: