From da3758c415c0efa3ab5d9cad547483d3ad56cbde Mon Sep 17 00:00:00 2001 From: Ashley Wulber Date: Wed, 8 Apr 2026 09:58:20 -0400 Subject: [PATCH] fix(text_input): always clip input text with the text bounds this issue seems unique to tiny-skia --- examples/application/Cargo.toml | 1 - src/widget/text_input/input.rs | 14 ++++++-------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/examples/application/Cargo.toml b/examples/application/Cargo.toml index bc037ec0..c494238f 100644 --- a/examples/application/Cargo.toml +++ b/examples/application/Cargo.toml @@ -18,7 +18,6 @@ features = [ "tokio", "xdg-portal", "a11y", - "wgpu", "single-instance", "surface-message", "multi-window", diff --git a/src/widget/text_input/input.rs b/src/widget/text_input/input.rs index 806ceda0..4336c757 100644 --- a/src/widget/text_input/input.rs +++ b/src/widget/text_input/input.rs @@ -2740,14 +2740,14 @@ pub fn draw<'a, Message>( effective_alignment(state.value.raw()), ); - if !cursors.is_empty() { + if cursors.is_empty() { + renderer.with_translation(Vector::ZERO, |_| {}); + } else { renderer.with_translation(Vector::new(alignment_offset - offset, 0.0), |renderer| { for (quad, color) in &cursors { renderer.fill_quad(*quad, *color); } }); - } else { - renderer.with_translation(Vector::ZERO, |_| {}); } let bounds = Rectangle { @@ -2785,11 +2785,9 @@ pub fn draw<'a, Message>( ); }; - if is_selecting { - renderer.with_layer(bounds, render); - } else { - render(renderer); - } + // FIXME: we always must clip with a layer because of what appears to be a tiny-skia text clipping issue. + // Otherwise overflowing text escapes the bounds of the input. + renderer.with_layer(text_bounds, render); let trailing_icon_tree = children.get(child_index);