From aa382959a7b1475f745499453e7408eca20c0011 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Sat, 25 Sep 2021 21:12:10 +0100 Subject: [PATCH] Make empty arrays work on a single line with `%#v` --- core/fmt/fmt.odin | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/fmt/fmt.odin b/core/fmt/fmt.odin index ca51be3b6..04fb08425 100644 --- a/core/fmt/fmt.odin +++ b/core/fmt/fmt.odin @@ -1219,6 +1219,10 @@ fmt_write_array :: proc(fi: ^Info, array_data: rawptr, count: int, elem_size: in io.write_byte(fi.writer, '[') defer io.write_byte(fi.writer, ']') + if count <= 0 { + return + } + if fi.hash { io.write_byte(fi.writer, '\n') defer fmt_write_indent(fi)