in src/components/padding.rs [62:83]
fn draw_unchecked(
&self,
state: &State,
dimensions: Dimensions,
mode: DrawMode,
) -> anyhow::Result<Vec<Line>> {
let mut output = self.child.draw(state, dimensions, mode)?;
// ordering is important:
// the top and bottom lines need to be padded horizontally too.
output.pad_lines_top(self.top);
// cut off enough space at the bottom for the bottom padding
output.truncate((dimensions.y as usize).saturating_sub(self.bottom));
output.pad_lines_bottom(self.bottom);
output.pad_lines_left(self.left);
// cut off enough space on the right for the right padding
output.truncate_lines((dimensions.x as usize).saturating_sub(self.right));
output.pad_lines_right(self.right);
Ok(output)
}