Skip to content

Commit 11526b6

Browse files
committed
breaking: Add positional, precision and width support to std.fmt
This removes the odd width and precision specifiers found and replacing them with the more consistent api described in #1358. Take the following example: {1:5.9} This refers to the first argument (0-indexed) in the argument list. It will be printed with a minimum width of 5 and will have a precision of 9 (if applicable). Not all types correctly use these parameters just yet. There are still some missing gaps to fill in. Fill characters and alignment have yet to be implemented.
1 parent 381c6a3 commit 11526b6

File tree

5 files changed

+354
-367
lines changed

5 files changed

+354
-367
lines changed

src-self-hosted/dep_tokenizer.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -999,7 +999,7 @@ fn printCharValues(out: var, bytes: []const u8) !void {
999999

10001000
fn printUnderstandableChar(out: var, char: u8) !void {
10011001
if (!std.ascii.isPrint(char) or char == ' ') {
1002-
std.fmt.format(out.context, anyerror, out.output, "\\x{X2}", char) catch {};
1002+
std.fmt.format(out.context, anyerror, out.output, "\\x{X:2}", char) catch {};
10031003
} else {
10041004
try out.write("'");
10051005
try out.write([_]u8{printable_char_tab[char]});

0 commit comments

Comments
 (0)