-
Notifications
You must be signed in to change notification settings - Fork 678
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proposal: updating text controls to properly handle large files #1842
Comments
I need this. For more clarity: I need this because I own a UWP rest client. When users ping an endpoint that returns an enormous amount of text, using UWP's native textbox controls will crash the app. For instance: jenius-apps/nightingale-rest-api-client#6. In the ideal world, my UWP rest client should be able to load text, edit text, and scroll the text with at least as much efficiency and performance as Notepad. I would love to get a control with at least the same text performance as Notepad. |
Yeah we need a control that can serve as a base for a code editor, with virtualization and callbacks when some text is changed to update the syntax highlighting for instance. |
@adrientetar We can more or less do that already by heavily customizing the |
I'm not sure about the performance of using RichEditBox spans since it's "retained mode", I think more designed for things like a word processor, unlike say vscode syntax highlighting. |
Yeah no, I agree that the performance of the I kept this one proposal very restricted in scope because it's a very specific issue and yet a very common one, and keeping the scope small will help the team properly track this. |
(pasting this from the Discord conversation we had, so others can see it) Thanks for highlighting this Sergio. This issue is a reasonable request, and I appreciate how you scoped it too. What I don't know is when we'd be able to do this--the team is largely focused on 3 areas right now:
This ask would kinda fall into bucket #3. Most of the "bucket 3" work we do is in WinUI 2--the reason being that it allows people to start using those new capabilities now instead of having to wait until WinUI 3 ships. Unfortunately we can't change how our text controls work via WinUI 2, since our text controls are "baked into the UWP XAML platform". So, if we wanted to improve this, then we're talking about doing this in WinUI 3. We could certainly look at doing this in 3.0, or 3.1; we'd just have to weigh it against the other asks we have from the community, and everyone would need to know that it would be many months before the new capability would be something you could consume (due to it requiring WinUI 3 to ship first). I'm going to unassign myself for now since I'm not actively working on it, but we can revisit once we start to wade thru the backlog of these WinUI 3-centric asks. |
For people who stumble over this and are searching for a fast text editor control for WinUI 3 that handles >10000 lines: CodeWriter-WinUI |
Just tried to open a file of 600 Kb in a RichEditBox with the Document.LoadFromStream() method. As it doesn't have any async method it just blocks the UI thread for 2 seconds (considering I have a very powerful configuration on my PC). This should be prioritized as it's a very serious limitation for anyone trying to display file contents. For now I'll have to park the feature I worked on because I spent a few days trying to unblock the UI thread with no results. |
Bumping this (see #8638). |
Another day, another WTF in WinUI3-Land. |
Proposal: updating text controls to properly handle large files
Creating this issue as suggested by @anawishnoff on Twitter. This proposal links back to a similar one on the UWP Community Toolkit about a virtualized RichEditBox control.
Summary
One common complaints about the native text controls on UWP (namely,
TextBlock
,TextBox
,RichTextBlock
,RichEditBox
) is that they are not able to properly handle large files. Trying to load a 1MB text file into any of those controls will cause apps to either become unsustainably slow, or just crash. So far developers have either had to limit functionality in their apps to avoid hitting this issue, implement solutions like using multipleTextBlock
controls in a virtualized items panel (which has its own set of downsides), or resort to (paid) 3rd party controls that properly supported this scenario. Some have just gave up on working on UWP because of this, unfortunately.The proposal is to update the existing text controls so that they will behave properly even when dealing with large text documents to render.
NOTE: this proposal is pretty much a draft and meant to also just help spark a conversation about this issue. If a better approach to solve this would be to just add some new, specialized controls to handle large files, that could be ok too. The bottom line is, there should be a native way on UWP to display large text files, without the need for custom controls.
Rationale
Scope
Open Questions
As mentioned in the note above, whether the best way to approach this would be to just update the existing controls, or to include some additional, specialized controls to WinUI, is open for discussion.
The text was updated successfully, but these errors were encountered: