Skip to content

component_preview: Fix example rendering no text or icons#59241

Open
grishy wants to merge 1 commit into
zed-industries:mainfrom
grishy:component-preview-example
Open

component_preview: Fix example rendering no text or icons#59241
grishy wants to merge 1 commit into
zed-industries:mainfrom
grishy:component-preview-example

Conversation

@grishy

@grishy grishy commented Jun 13, 2026

Copy link
Copy Markdown

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:

  • I've reviewed my own diff for quality, security, and reliability
  • Unsafe blocks (if any) have justifying comments
  • The content adheres to Zed's UI standards (UX/UI and icon guidelines)

Showcase

Before:
cp_pr1_before

After:
cp_pr1_after


Release Notes:

  • N/A

The example never attached the embedded asset source and built
gpui_platform without any platform text-system features. On macOS the
missing "font-kit" feature makes MacPlatform fall back to
gpui::NoopTextSystem, which accepts fonts and resolves font ids but
rasterizes every glyph to an empty bitmap, so the window rendered no
text at all. On Linux the missing "wayland"/"x11" features leave no
windowing backend either. Icons were missing because the SVG assets
were never embedded.

Attach Assets and load the embedded fonts (the default ".ZedSans" UI
font resolves to the bundled IBM Plex Sans, which is not a system
font), and enable the same gpui_platform features as the zed binary.
Initialize env_logger so platform warnings reach the terminal.

Also fix three startup panics:

- zed::Quit is already registered by zed_actions (linked through the
  workspace crate), so the example's own Quit action moves to the
  component_preview namespace.
- db::kvp::KeyValueStore::global panics unless the app database global
  is set first.
- ui_input::InputField panics unless the editor factory registered by
  editor::init exists.
@cla-bot cla-bot Bot added the cla-signed The user has signed the Contributor License Agreement label Jun 13, 2026
@zed-community-bot zed-community-bot Bot added the first contribution the author's first pull request to Zed. NOTE: the label application is automated via github actions label Jun 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement first contribution the author's first pull request to Zed. NOTE: the label application is automated via github actions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant