fix(text area): fix initial flicker in rendering#5842
Conversation
Fix initial flicker in the `TextArea`, where for a brief moment each character is rendered on a new line before the size is settled. The width for the `WrappedDocument` is _slightly_ confusing where zero means no wrapping, but the current negative wrap width looks like the bug. Fixes #5841
|
I've tested manually obviously with the examples in the linked issue, but I'm not sure it's possible to add a regression test for this flicker. |
|
I think there is still a flickering even when |
Strange, I don't see the same flicker with this change. Do you mean a different kind of flicker, or do you have an example to demonstrate? Running your example with some debug logs, here's extracts from the console before and after this change. BeforeAfter |
|
No the letters don't appear to be rendered individually with Screencast.From.2025-06-05.15-36-55.mp4 |
|
Sorry I think I understand what you mean now - you've not tested with this change but just setting Good catch - it looks like the |
Ensure `TextArea.__init__()` assigns attributes like `soft_wrap` *before* calling the `_set_document()` method. Currently if you create a `TextArea` with `soft_wrap=False`, the document is first wrapped with the default `soft_wrap=True`, causing an initial flicker.
|
Fixed in 4653f30 by ensuring the attribute is assigned before trying to wrap the document. Again tested manually but don't think it's possible to add a regression test for this. |
Fix initial flicker in the
TextArea, where for a brief moment each character is rendered on a new line before the size is settled.The width for the
WrappedDocumentis slightly confusing where zero means no wrapping, but the current negative wrap width looks like the bug.Fixes #5841
Please review the following checklist.