diff options
| author | gingerBill <gingerBill@users.noreply.github.com> | 2025-01-24 13:01:43 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-24 13:01:43 +0000 |
| commit | 1a7d2ca2e1437edbc36cee30e59e6599dae3d74a (patch) | |
| tree | 7b5de642f4584c2346101bf04fa2aa3e665f0536 | |
| parent | 867af80bff2956178ac72d9afbc9327b67cd4ae8 (diff) | |
| parent | 7127992625d8d1df4db6140f564526004aa3eaa3 (diff) | |
Merge pull request #4745 from flysand7/fmt-sign-pad
Fix the '+' sign placement in the presence of '0'-padding
| -rw-r--r-- | core/fmt/fmt.odin | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/core/fmt/fmt.odin b/core/fmt/fmt.odin index da3b419d5..51e70f6b7 100644 --- a/core/fmt/fmt.odin +++ b/core/fmt/fmt.odin @@ -1379,9 +1379,9 @@ _pad :: proc(fi: ^Info, s: string) { if fi.minus { // right pad io.write_string(fi.writer, s, &fi.n) fmt_write_padding(fi, width) - } else if !fi.space && s != "" && s[0] == '-' { + } else if !fi.space && s != "" && (s[0] == '-' || s[0] == '+') { // left pad accounting for zero pad of negative number - io.write_byte(fi.writer, '-', &fi.n) + io.write_byte(fi.writer, s[0], &fi.n) fmt_write_padding(fi, width) io.write_string(fi.writer, s[1:], &fi.n) } else { // left pad |