diff --git a/libc/src/stdio/printf_core/char_converter.h b/libc/src/stdio/printf_core/char_converter.h --- a/libc/src/stdio/printf_core/char_converter.h +++ b/libc/src/stdio/printf_core/char_converter.h @@ -29,7 +29,7 @@ // If the padding is on the left side, write the spaces first. if (padding_spaces > 0 && (to_conv.flags & FormatFlags::LEFT_JUSTIFIED) == 0) { - RET_IF_RESULT_NEGATIVE(writer->write(' ', to_conv.min_width - string_len)); + RET_IF_RESULT_NEGATIVE(writer->write(' ', padding_spaces)); } RET_IF_RESULT_NEGATIVE(writer->write(c)); @@ -37,7 +37,7 @@ // If the padding is on the right side, write the spaces last. if (padding_spaces > 0 && (to_conv.flags & FormatFlags::LEFT_JUSTIFIED) != 0) { - RET_IF_RESULT_NEGATIVE(writer->write(' ', to_conv.min_width - string_len)); + RET_IF_RESULT_NEGATIVE(writer->write(' ', padding_spaces)); } return WRITE_OK; diff --git a/libc/src/stdio/printf_core/string_converter.h b/libc/src/stdio/printf_core/string_converter.h --- a/libc/src/stdio/printf_core/string_converter.h +++ b/libc/src/stdio/printf_core/string_converter.h @@ -39,7 +39,7 @@ // If the padding is on the left side, write the spaces first. if (padding_spaces > 0 && (to_conv.flags & FormatFlags::LEFT_JUSTIFIED) == 0) { - RET_IF_RESULT_NEGATIVE(writer->write(' ', to_conv.min_width - string_len)); + RET_IF_RESULT_NEGATIVE(writer->write(' ', padding_spaces)); } RET_IF_RESULT_NEGATIVE(writer->write( @@ -48,7 +48,7 @@ // If the padding is on the right side, write the spaces last. if (padding_spaces > 0 && (to_conv.flags & FormatFlags::LEFT_JUSTIFIED) != 0) { - RET_IF_RESULT_NEGATIVE(writer->write(' ', to_conv.min_width - string_len)); + RET_IF_RESULT_NEGATIVE(writer->write(' ', padding_spaces)); } return WRITE_OK; }