Skip to content

Commit

Permalink
Fix: Truncation did not apply base style
Browse files Browse the repository at this point in the history
  • Loading branch information
phire22 committed Apr 29, 2024
1 parent 2b02e16 commit 3186318
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/widget.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ impl<'a, T: ListableWidget> StatefulWidget for List<'a, T> {
if area.height < item.main_axis_size {
// Determine if truncation should happen at the top or the bottom
let truncate_top = i == 0 && num_items > 1;
render_truncated(item, area, buf, scroll_axis, truncate_top);
render_truncated(item, area, buf, scroll_axis, truncate_top, self.style);
} else {
item.item.render(area, buf);
}
Expand All @@ -193,6 +193,7 @@ fn render_truncated<T: ListableWidget>(
buf: &mut Buffer,
scroll_axis: ScrollAxis,
truncate_top: bool,
base_style: Style,
) {
let item_size = item.main_axis_size;
// Create an intermediate buffer for rendering the truncated element
Expand All @@ -206,6 +207,7 @@ fn render_truncated<T: ListableWidget>(
width,
height,
});
hidden_buffer.set_style(hidden_buffer.area, base_style);
item.item.render(hidden_buffer.area, &mut hidden_buffer);

// Copy the visible part from the intermediate buffer to the main buffer
Expand Down

0 comments on commit 3186318

Please sign in to comment.