Files
zed/crates
Agus Zubiaga 7c46498fe8 gpui: Add split and paint APIs on LineLayout (#60831)
`ShapedLine` is nearly 3KB by value because it inlines a
`SmallVec<[DecorationRun; 32]>`. A consumer that builds wrapped lines
out of many small uniformly styled fragments only needs the shaped
glyphs plus a single decoration run it can track itself, but it ends up
moving and reallocating that mostly dead capacity constantly because
splitting and painting are only reachable through `ShapedLine`.

This moves the glyph-partitioning half of `ShapedLine::split_at` down to
a new `LineLayout::split_at`, and adds
`LineLayout::paint`/`paint_background` methods that take explicit
decoration runs. Together with the already-public `layout_line`, callers
can now hold a bare `Arc<LineLayout>` and their own decorations.
`ShapedLine::split_at` delegates to the new method and behaves the same.

## Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content adheres to Zed's UI standards
([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
and
[icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md)
guidelines)
- [ ] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

---

Release Notes:

- N/A
2026-08-19 17:40:37 +00:00
..
2026-08-09 22:29:52 +00:00
2026-08-09 22:29:52 +00:00
2026-08-09 22:29:52 +00:00
2026-04-29 10:27:47 +00:00
2026-08-09 22:29:52 +00:00
2026-08-09 22:29:52 +00:00
2026-05-04 06:30:47 +00:00
2026-08-09 22:29:52 +00:00
2026-07-21 07:58:16 +00:00
…
…
2026-05-27 10:31:53 +00:00
2026-04-29 10:27:47 +00:00
2026-08-09 22:29:52 +00:00
2026-08-09 22:29:52 +00:00
2026-05-27 10:31:53 +00:00
2026-08-19 16:01:01 +00:00
2026-08-09 22:29:52 +00:00