Commit f9d57b5
authored
component_preview: Fix example rendering no text or icons (#59241)
`cargo run -p component_preview --example component_preview` does not
work.
On current main it panics at startup:
```
thread 'main' panicked at crates/gpui/src/action.rs:296:13:
Action with name `zed::Quit` already registered
```
With that panic fixed, the window opens but renders no text and no icons
(see Showcase below).s
## Solution
Root cause for the blank window: `component_preview` package resolves
`gpui_platform` with just `"screen-capture"`.
On macOS the missing `font-kit` feature makes `MacPlatform` fall back to
`gpui::NoopTextSystem`, as mentiond also in README (or CONTRIBUTE) file.
On Linux the missing `wayland`/`x11` features leave no windowing backend
at all.
list of changes:
- Enable the same `gpui_platform` features as the `zed` binary.
- Attach `Assets` and load the embedded fonts.
- Initialize `env_logger` so platform warnings reach the terminal.
- Fix three startup panics: move the example's `Quit` action to the
`component_preview` namespace.
## Testing
Tested on macOS/Linux, not tested on Windows. I use Parallel VMs.
## 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)
## Showcase
Before:
<img width="1312" height="945" alt="cp_pr1_before"
src="https://github.com/user-attachments/assets/4611596f-6775-4863-bd4a-5f4d8c642e35"
/>
After:
<img width="1312" height="945" alt="cp_pr1_after"
src="https://github.com/user-attachments/assets/8f8082e6-c8cd-48f5-946a-032ce8186d30"
/>
---
Release Notes:
- N/A1 parent f39cf25 commit f9d57b5
3 files changed
Lines changed: 19 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
44 | 47 | | |
45 | 48 | | |
46 | 49 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
19 | | - | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
26 | | - | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
27 | 32 | | |
28 | 33 | | |
29 | 34 | | |
30 | 35 | | |
31 | 36 | | |
32 | 37 | | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
33 | 42 | | |
34 | 43 | | |
35 | 44 | | |
| |||
68 | 77 | | |
69 | 78 | | |
70 | 79 | | |
| 80 | + | |
71 | 81 | | |
72 | 82 | | |
73 | 83 | | |
| |||
0 commit comments