microsoft-ui-xaml
microsoft-ui-xaml copied to clipboard
TextBox.AcceptsReturn lost \n in UWP
This issue has been moved from a ticket on Developer Community.
I set TextBox.AcceptsRetrun = true in UWP project.
When I key down Enter and new line the content, the TextBox.Text don't provider \n , only got \r.
I test WPF project, it don't have the issue.
reference the link: https://stackoverflow.com/questions/42498195/uwp-textbox-is-missing-the-line-feed-n-character-in-windows-10-build-14393
TextBox lost \n already be happen on Windows 10 (14393).
Original Comments
Visual Studio Feedback System on 1/2/2020, 06:10 PM:
We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.
Original Solutions
(no solutions)
@ddalp Do you know if there's any standing issues with this, or has the behavior always diverged from WPF?
@chrisglein XAML TextBox had this behavior since RS1, it is because richedit internally using the \r in its data store for line breaker while XAML converts text back with "\r\n". Some of the TextBox API will have problem if it has something to do with the text position(i.e. SelectionStart) or length(Length, MaxLength), since we pass it back and forth with RichEdit directly. So in RS1, we switched to "\r" to be consistent with richedit.
To fix it, we need RichEdit to support configurable line breaker for its internal data store which XAML can ask it to use "\r\n" instead of "\r".
TextBox should write Environment.NewLine when you hit Enter. It's totally unacceptable. Please revert the code to the correct behaviour and fix richedit elsewhere. It was a bad fix which should be rolled back. I share code with Android xamarin and all new lines are stripped off in android app because of this bug. Lines are merged into one line. I don't think it should be fixed on my side in my code. While it's not critical when you use one platform it's a breaking feature for crossplatform code. Please fix it.
Seeing similar regression issue. Is there a fix planned for this or flag to adjust behavior? StringBuilder should handle this use case?
https://docs.microsoft.com/en-us/dotnet/api/system.environment.newline?view=net-5.0 NewLine is automatically appended to text processed by the Console.WriteLine and StringBuilder.AppendLine methods.
This is nuts, the only platform I'm familiar with that uses \r line endings is classic MacOS.
Is there any plans to fix this, because I'm now needing to shim my data coming out of WinUI because no other platform knows how to process \r line endings.
For anyone looking for a work around, best I came up with 5 minutes of thinking about the problem in my space was to use a converter which calls ReplaceLineEndings.
Please fix this bug!
Unfortunately this would be a breaking change. What we need to do is add the property to TextBox to choose one over the other and keep the default the same. Switching this to a feature proposal.
Any plans to tackle this issue in the near future? I'm having the same problems in our UWP app and to say the least: This behavior does not match any other newline delimiter on Windows at all!
Again, a strange thing for Microsoft to wait years for such an annoying little thing... If someone out there does notice this bug..