text_view: Fix list item text wrap. (#1027)

## Before

<img width="911" alt="image"
src="https://github.com/user-attachments/assets/cfe01686-48da-4140-84d0-ead361833131"
/>

## After

<img width="902" alt="image"
src="https://github.com/user-attachments/assets/fb97f8e8-3f16-43c4-8223-b7c6fdcc269f"
/>
This commit is contained in:
Jason Lee 2025-07-02 15:25:58 +08:00 committed by GitHub
parent 41663ca030
commit a28ad0b1f1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -430,17 +430,20 @@ impl Node {
// merge content into last item.
if last_not_list {
if let Some(item_item) = items.last_mut() {
item_item.extend(vec![text.into_any_element()]);
item_item.extend(vec![div()
.overflow_hidden()
.child(text)
.into_any_element()]);
continue;
}
}
items.push(
h_flex()
.flex_1()
.relative()
.items_start()
.content_start()
.flex_1()
.when(!state.todo && checked.is_none(), |this| {
this.child(list_item_prefix(
ix,
@ -471,7 +474,7 @@ impl Node {
}),
)
})
.child(text),
.child(div().overflow_hidden().child(text)),
);
}
Node::List { .. } => {