Skip to content
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

Investigate reducing TextArea updates #4086

Open
willmcgugan opened this issue Jan 31, 2024 · 4 comments
Open

Investigate reducing TextArea updates #4086

willmcgugan opened this issue Jan 31, 2024 · 4 comments
Assignees

Comments

@willmcgugan
Copy link
Collaborator

The TextArea tends to refresh the entire widget on update. We should investigate the possibility of either programatically figuring out changed regions, or doing some kind of automatic comparison with the previous frame.

@darrenburns
Copy link
Member

I think this would be incredibly difficult to implement within the TextArea itself unless we opted for a diffing approach, and if we're doing that, it'd probably be better to do it at the Textual level somehow. There are just so many things that can result in lines changing outwith the line that is currently being edited (syntax highlighting, wrapping, an edit can result in scrollbars appearing which can change wrapping, some edits can influence lines below them, and so on...).

@darrenburns
Copy link
Member

Could you let me know your thoughts @willmcgugan?

@willmcgugan
Copy link
Collaborator Author

Ideally the widget can calculate which areas change, but as you said the TextArea makes that impractical.

I think we could do a diffing approach at the Textual level. When we render the widget we can store the rendered strips somewhere, then when we render a subsequent frame we could compare them line by line and only refresh lines which have changed.

This wouldn't be very precise. If we have a flashing cursor it would update a line rather than a single cell, but it would be better that updating the entire widget.

I think this should be an opt-in thing for line API widgets. May delta_updates=True or something.

@willmcgugan
Copy link
Collaborator Author

@davep @rodrigogiraoserrao Please consider tackling this. Let me know if you want to discuss your approach beforehand.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants