diff options
| author | Josh <jtdonahue360@gmail.com> | 2020-06-12 18:05:40 -0400 |
|---|---|---|
| committer | Josh <jtdonahue360@gmail.com> | 2020-06-12 18:05:40 -0400 |
| commit | 6648dc9ed188a99ca7f22a5fbd53d35440f2beff (patch) | |
| tree | 894ae9ae44fe90533e4ffcaa5963bf72c97c99a7 | |
| parent | bbbf7168f1e74a4c9c18a7a23ba379ce5f46df24 (diff) | |
use width in when printing formatted string to control padding added after the string
| -rw-r--r-- | core/fmt/fmt.odin | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/core/fmt/fmt.odin b/core/fmt/fmt.odin index 31eaa965d..d9f379da0 100644 --- a/core/fmt/fmt.odin +++ b/core/fmt/fmt.odin @@ -898,6 +898,11 @@ fmt_string :: proc(fi: ^Info, s: string, verb: rune) { switch verb { case 's', 'v': strings.write_string(fi.buf, s); + if fi.width_set && len(s) < fi.width { + for i in 0..<fi.width - len(s) { + strings.write_byte(fi.buf, ' '); + } + } case 'q': // quoted string strings.write_quoted_string(fi.buf, s, '"'); |