| ... | @@ -537,7 +537,7 @@ fn replace_variables( | ... | @@ -537,7 +537,7 @@ fn replace_variables( |
| 537 | switch (value) { | 537 | switch (value) { |
| 538 | .boolean => |b| { | 538 | .boolean => |b| { |
| 539 | const buf = try std.fmt.allocPrint(allocator, "{s}{}{s}", .{ beginline, @intFromBool(b), endline }); | 539 | const buf = try std.fmt.allocPrint(allocator, "{s}{}{s}", .{ beginline, @intFromBool(b), endline }); |
| 540 | last_index = start_index + 1; | 540 | last_index = prefix_index + 1; |
| 541 | | 541 | |
| 542 | allocator.free(content_buf); | 542 | allocator.free(content_buf); |
| 543 | content_buf = buf; | 543 | content_buf = buf; |
| ... | @@ -546,14 +546,14 @@ fn replace_variables( | ... | @@ -546,14 +546,14 @@ fn replace_variables( |
| 546 | const buf = try std.fmt.allocPrint(allocator, "{s}{}{s}", .{ beginline, i, endline }); | 546 | const buf = try std.fmt.allocPrint(allocator, "{s}{}{s}", .{ beginline, i, endline }); |
| 547 | const isNegative = i < 0; | 547 | const isNegative = i < 0; |
| 548 | const digits = (if (0 < i) std.math.log10(@abs(i)) else 0) + 1; | 548 | const digits = (if (0 < i) std.math.log10(@abs(i)) else 0) + 1; |
| 549 | last_index = start_index + @intFromBool(isNegative) + digits + 1; | 549 | last_index = prefix_index + @intFromBool(isNegative) + digits; |
| 550 | | 550 | |
| 551 | allocator.free(content_buf); | 551 | allocator.free(content_buf); |
| 552 | content_buf = buf; | 552 | content_buf = buf; |
| 553 | }, | 553 | }, |
| 554 | .string, .ident => |x| { | 554 | .string, .ident => |x| { |
| 555 | const buf = try std.fmt.allocPrint(allocator, "{s}{s}{s}", .{ beginline, x, endline }); | 555 | const buf = try std.fmt.allocPrint(allocator, "{s}{s}{s}", .{ beginline, x, endline }); |
| 556 | last_index = start_index + x.len + 1; | 556 | last_index = prefix_index + x.len; |
| 557 | | 557 | |
| 558 | allocator.free(content_buf); | 558 | allocator.free(content_buf); |
| 559 | content_buf = buf; | 559 | content_buf = buf; |
| ... | @@ -561,7 +561,7 @@ fn replace_variables( | ... | @@ -561,7 +561,7 @@ fn replace_variables( |
| 561 | | 561 | |
| 562 | else => { | 562 | else => { |
| 563 | const buf = try std.fmt.allocPrint(allocator, "{s}{s}", .{ beginline, endline }); | 563 | const buf = try std.fmt.allocPrint(allocator, "{s}{s}", .{ beginline, endline }); |
| 564 | last_index = start_index + 1; | 564 | last_index = prefix_index; |
| 565 | | 565 | |
| 566 | allocator.free(content_buf); | 566 | allocator.free(content_buf); |
| 567 | content_buf = buf; | 567 | content_buf = buf; |