-
Notifications
You must be signed in to change notification settings - Fork 45
Description
To reproduce, you can apply this patch then select all and press backspace or delete:
Patch to reproduce
diff --git a/examples/vello_editor/src/main.rs b/examples/vello_editor/src/main.rs
index 0422e76..8ab97cf 100644
--- a/examples/vello_editor/src/main.rs
+++ b/examples/vello_editor/src/main.rs
@@ -119,7 +119,7 @@ impl ApplicationHandler<accesskit_winit::Event> for SimpleVelloApp<'_> {
self.editor.transact(|txn| {
txn.set_scale(1.0);
- txn.set_width(Some(size.width as f32 - 2f32 * text::INSET));
+ txn.set_width(Some(0.0)); // This can be a higher value and still reproduce
txn.set_text(text::LOREM);
});
@@ -238,9 +238,8 @@ impl ApplicationHandler<accesskit_winit::Event> for SimpleVelloApp<'_> {
.resize_surface(&mut render_state.surface, size.width, size.height);
self.editor.transact(|txn| {
txn.set_scale(1.0);
- txn.set_width(Some(size.width as f32 - 2f32 * text::INSET));
txn.set_default_style(Arc::new([
- StyleProperty::FontSize(32.0),
+ StyleProperty::FontSize(16.0),
StyleProperty::LineHeight(1.2),
GenericFamily::SystemUi.into(),
]));
diff --git a/examples/vello_editor/src/text.rs b/examples/vello_editor/src/text.rs
index 2211c7e..178b033 100644
--- a/examples/vello_editor/src/text.rs
+++ b/examples/vello_editor/src/text.rs
@@ -77,7 +77,7 @@ impl Editor {
pub fn handle_event(&mut self, event: WindowEvent) {
match event {
WindowEvent::Resized(size) => {
- self.transact(|txn| txn.set_width(Some(size.width as f32 - 2f32 * INSET)));
+ // self.transact(|txn| txn.set_width(Some(1.0)));
}
WindowEvent::ModifiersChanged(modifiers) => {
self.modifiers = Some(modifiers);
On my machine, any width less than an unknown value in [3.52, 3.521) causes a crash. The backtrace is:
Backtrace
thread 'main' panicked at parley/parley/src/layout/line/greedy.rs:740:26:
called `Option::unwrap()` on a `None` value
stack backtrace:
0: rust_begin_unwind
1: core::panicking::panic_fmt
2: core::panicking::panic
3: core::option::unwrap_failed
4: parley::layout::line::greedy::try_commit_line
5: parley::layout::line::greedy::BreakLines<B>::break_remaining
6: parley::layout::editor::PlainEditor<T>::update_layout
7: parley::layout::editor::PlainEditor<T>::replace_selection
8: parley::layout::editor::PlainEditor<T>::transact
9: vello_editor::text::Editor::handle_event
10: <vello_editor::SimpleVelloApp as winit::application::ApplicationHandler<accesskit_winit::Event>>::window_event
11: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
12: winit::platform_impl::linux::wayland::event_loop::EventLoop<T>::pump_events
13: winit::platform_impl::linux::wayland::event_loop::EventLoop<T>::run_on_demand
14: vello_editor::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
And therefore the offending unwrap is:
parley/parley/src/layout/line/greedy.rs
Lines 765 to 767 in c0d158b
let first_cluster = run | |
.get(cluster_range.start - run_data.cluster_range.start) | |
.unwrap(); |
Metadata
Metadata
Assignees
Labels
No labels