emilk/egui · error

Galley should be available here

Error message

Galley should be available here

What it means

Error "Galley should be available here" thrown in emilk/egui.

Source

Thrown at crates/egui/src/widgets/text_edit/builder.rs:760

                allocated
                    .frame
                    .fill(background_color)
                    .corner_radius(corner_radius)
                    .inner_margin(
                        allocated.frame.inner_margin
                            + Margin::same((visuals.expansion - stroke.width).round() as i8),
                    )
                    .outer_margin(Margin::same(-(visuals.expansion as i8)))
                    .stroke(stroke)
            };

            allocated.paint(ui)
        };

        let inner_rect = response.rect(inner_rect_id).unwrap_or(Rect::ZERO);

        // Our atom closure was now called, so the galley should always be available here
        let mut galley = get_galley.expect("Galley should be available here");

        // Don't send `OutputEvent::Clicked` when a user presses the space bar
        response.flags -= response::Flags::FAKE_PRIMARY_CLICKED;
        let text_clip_rect = inner_rect;
        let painter = ui.painter_at(text_clip_rect.expand(1.0)); // expand to avoid clipping cursor

        if interactive && let Some(pointer_pos) = response.interact_pointer_pos() {
            if response.hovered() && text.is_mutable() {
                ui.output_mut(|o| o.mutable_text_under_cursor = true);
            }

            // TODO(emilk): drag selected text to either move or clone (ctrl on windows, alt on mac)

            let cursor_at_pointer = galley.cursor_from_pos(
                pointer_pos - inner_rect.min + state.text_offset + vec2(galley.rect.left(), 0.0),
            );

            if ui.visuals().text_cursor.preview

View on GitHub (pinned to d802a982ce)

When it happens

Trigger: Thrown at crates/egui/src/widgets/text_edit/builder.rs:760 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of emilk/egui@d802a982ce (2026-08-16). Data as JSON: /api/errors/519ab2ab30ae24b1. Report an issue: GitHub.