Skip to content

live_text panics on wrapping, truncated or span-styled text #422

Done

Description

@michael-dm

Why: live video tools draw on-air graphics (lower thirds, scorebugs, tickers) as HTML in an embedded Chromium, which costs a browser per graphic and runs on its own clock. Rune rendering straight onto the video pipeline's wgpu device would be a far lighter replacement. That use needs frames driven by the host's clock, and no stalls or crashes on air.

El::live_text asserts "live_text requires plain single-line text" (runtime/commit/flatten.rs) when the element wraps, is truncated or has spans.

In an app this is a bug to fix while developing. In a host that runs third-party views, such as a compositor showing graphics written by others, it takes the whole process down on content it doesn't control.

A live value in a box that wraps (a caption, a ticker line) seems a reasonable thing to ask for. Where a binding can't be honoured, degrading would be safer than panicking.

Activity

  1. Hona commented on Nov 24, 2026

    @Hona
    Member

    Implemented on dev in #1912 (3864fce).

    El::live_text no longer panics at commit or build time when combined with wrapping, truncation, spans, word reveals, redaction, or text editors:

    • Plain single-line live_text (including .truncate_fade()) keeps its existing single-line layout_live fast path.
    • .wrap(), .truncate() / .truncate_middle() / .truncate_head(), and .max_lines(n) re-wrap or re-elide in place inside the element's existing box width without reflowing siblings or growing the layout/elision caches.
    • Incompatible combinations (spans, links, pills, word reveal, redaction, text editors, or non-text elements) ignore the live binding and keep the authored text safely.
    let caption = rune::LiveText::new("Starting...");
    let ticker = rune::LiveText::new("Frame 0");
    let wrapped = rune::text("Placeholder").size(120.0, 40.0).max_lines(2).live_text(&caption);
    let elided = rune::text("Placeholder").size(120.0, 18.0).truncate().live_text(&ticker);
    caption.set("Updated live caption that wraps and elides inside the fixed box");

    This follows Rune's existing lay_out_text_in_place fixed-box layout path (using Keep::Owned to keep caches bounded) and non-panicking builder behaviour in crates/rune/src/el/text.rs. See examples/live-values for a working demo.

    Verified with headless unit and integration tests on Windows and macOS (runtime::motion, runtime::commit, rune-core, rune-text, alloc, live, batch_c, motion_elements, pose_hit, expressive_motion) plus wasm32 WebGPU and WebGL checks. Not checked: a live desktop window or a Linux build.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions