Default to q for strings within structs

This commit is contained in:
gingerBill
2022-06-11 01:09:42 +01:00
parent c7269b9ef0
commit 7bded4f189
+6 -2
View File
@@ -943,10 +943,14 @@ fmt_float :: proc(fi: ^Info, v: f64, bit_size: int, verb: rune) {
fmt_string :: proc(fi: ^Info, s: string, verb: rune) {
s := s
s, verb := s, verb
if ol, ok := fi.optional_len.?; ok {
s = s[:min(len(s), ol)]
}
if fi.record_level >= 0 && verb == 'v' {
verb = 'q'
}
switch verb {
case 's', 'v':
if fi.width_set {
@@ -1269,7 +1273,7 @@ handle_tag :: proc(data: rawptr, info: reflect.Type_Info_Struct, idx: int, verb:
verb^ = r
if value[0] == ',' {
switch r {
case 's':
case 's', 'q':
if optional_len != nil {
field_name := value[1:]
for f, i in info.names {