summaryrefslogtreecommitdiff
path: root/sprintf.c
diff options
context:
space:
mode:
Diffstat (limited to 'sprintf.c')
-rw-r--r--sprintf.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sprintf.c b/sprintf.c
index 63ac093f29..1e3e76c4ad 100644
--- a/sprintf.c
+++ b/sprintf.c
@@ -794,6 +794,8 @@ rb_str_format(int argc, const VALUE *argv, VALUE fmt)
buf[blen + need - strlen(expr) - 1] = '-';
else if (flags & FPLUS)
buf[blen + need - strlen(expr) - 1] = '+';
+ else if ((flags & FSPACE) && need > width)
+ blen++;
strncpy(&buf[blen + need - strlen(expr)], expr,
strlen(expr));
}