fix(text_input): always clip input text with the text bounds

this issue seems unique to tiny-skia
This commit is contained in:
Ashley Wulber 2026-04-08 09:58:20 -04:00 committed by Michael Murphy
parent 47ab72be50
commit a44cff8011
2 changed files with 6 additions and 9 deletions

View file

@ -18,7 +18,6 @@ features = [
"tokio",
"xdg-portal",
"a11y",
"wgpu",
"single-instance",
"surface-message",
"multi-window",

View file

@ -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);