| ... | @@ -99,7 +99,8 @@ pub fn format( | ... | @@ -99,7 +99,8 @@ pub fn format( |
| 99 | @setEvalBranchQuota(2000000); | 99 | @setEvalBranchQuota(2000000); |
| 100 | comptime var arg_state: ArgState = .{ .args_len = fields_info.len }; | 100 | comptime var arg_state: ArgState = .{ .args_len = fields_info.len }; |
| 101 | comptime var i = 0; | 101 | comptime var i = 0; |
| 102 | inline while (i < fmt.len) { | 102 | comptime var literal: []const u8 = ""; |
| | 103 | inline while (true) { |
| 103 | const start_index = i; | 104 | const start_index = i; |
| 104 | | 105 | |
| 105 | inline while (i < fmt.len) : (i += 1) { | 106 | inline while (i < fmt.len) : (i += 1) { |
| ... | @@ -121,14 +122,17 @@ pub fn format( | ... | @@ -121,14 +122,17 @@ pub fn format( |
| 121 | i += 2; | 122 | i += 2; |
| 122 | } | 123 | } |
| 123 | | 124 | |
| 124 | // Write out the literal | 125 | literal = literal ++ fmt[start_index..end_index]; |
| 125 | if (start_index != end_index) { | | |
| 126 | try writer.writeAll(fmt[start_index..end_index]); | | |
| 127 | } | | |
| 128 | | 126 | |
| 129 | // We've already skipped the other brace, restart the loop | 127 | // We've already skipped the other brace, restart the loop |
| 130 | if (unescape_brace) continue; | 128 | if (unescape_brace) continue; |
| 131 | | 129 | |
| | 130 | // Write out the literal |
| | 131 | if (literal.len != 0) { |
| | 132 | try writer.writeAll(literal); |
| | 133 | literal = ""; |
| | 134 | } |
| | 135 | |
| 132 | if (i >= fmt.len) break; | 136 | if (i >= fmt.len) break; |
| 133 | | 137 | |
| 134 | if (fmt[i] == '}') { | 138 | if (fmt[i] == '}') { |