Skip to content

Commit e1d0a50

Browse files
committed
fix(text): paragraph_gap ignored in non-scrollable render path
All blocks were given is_last=true via a shared NodeRenderOptions, causing every block's margin-bottom to resolve to rems(0). Paragraph spacing set via TextViewStyle::paragraph_gap had no visible effect. Mirror the virtualized-list path: compute is_last per block so only the final block gets zero bottom spacing. Signed-off-by: Sven Kanoldt <sven@d34dl0ck.me>
1 parent 023f2e8 commit e1d0a50

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

crates/ui/src/text/document.rs

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,19 +57,30 @@ impl ParsedDocument {
5757
window: &mut Window,
5858
cx: &mut App,
5959
) -> impl IntoElement {
60-
let options = NodeRenderOptions {
61-
is_last: true,
62-
..Default::default()
63-
};
64-
6560
let Some(list_state) = list_state else {
61+
let blocks_len = self.blocks.len();
6662
return div()
6763
.id("document")
6864
.children(self.blocks.iter().enumerate().map(move |(ix, node)| {
69-
node.render_block(NodeRenderOptions { ix, ..options }, node_cx, window, cx)
65+
let is_last = ix + 1 == blocks_len;
66+
node.render_block(
67+
NodeRenderOptions {
68+
ix,
69+
is_last,
70+
..Default::default()
71+
},
72+
node_cx,
73+
window,
74+
cx,
75+
)
7076
}));
7177
};
7278

79+
let options = NodeRenderOptions {
80+
is_last: true,
81+
..Default::default()
82+
};
83+
7384
let blocks = &self.blocks;
7485

7586
if list_state.item_count() != blocks.len() {

0 commit comments

Comments
 (0)