You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
### Description
Made the layout manager *move* lines that weren't invalidated instead of re-typesetting them. Also made the reuse queue just make views tiny and hide them instead of removing them from the view hierarchy, and queue more views.
After these changes, layout in the source editor goes from taking up *36% of the CPU* time while editing, to taking up **5% of main thread CPU time**.
- Added a new debug mode for visualizing line fragment invalidation.
- Adjusted the layout pass to avoid typesetting lines that don't need layout.
- Made a distinction between 'forced layout' via `setNeedsLayout` and 'continued' layout where a line previously scanned in the layout pass was updated.
- Due to that, I was able to check if a line fragment actually needed typesetting or just potentially needed to have it's position adjusted.
- Added a new method to update a line's view's positions during layout.
- Removed the unnecessary `lineRange` variable on the `LineFragment` class.
- Adjusted the use of `documentRange` on the `LineFragment` class. It's now updated during layout, simplifying various methods.
### Related Issues
* N/A
### Checklist
- [x] I read and understood the [contributing guide](https://github.com/CodeEditApp/CodeEdit/blob/main/CONTRIBUTING.md) as well as the [code of conduct](https://github.com/CodeEditApp/CodeEdit/blob/main/CODE_OF_CONDUCT.md)
- [x] The issues this PR addresses are related to each other
- [x] My changes generate no new warnings
- [x] My code builds and runs on my machine
- [x] My changes are all related to the related issue above
- [x] I documented my code
### Screenshots
Before:
https://github.com/user-attachments/assets/05027712-5690-4970-b1ab-e0b4fe9553ec
After:
https://github.com/user-attachments/assets/36350ea1-66d8-43d0-a676-1bb770a733d7
0 commit comments