From: Kevin Day Date: Sat, 7 Sep 2024 13:45:32 +0000 (-0500) Subject: Bugfix: FSS Embedded List Read printing tabbing when using original mode and trim... X-Git-Tag: 0.6.12~6 X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=0b24eab9fc596cc1d5612aa549ef31bf96e30f87;p=fll Bugfix: FSS Embedded List Read printing tabbing when using original mode and trim mode. Do not double-print the before spaces when both original and trim modes are in use. Print the before even with original and trim are in use when the Object has no size. --- diff --git a/level_3/fss_embedded_list_read/c/private-print.c b/level_3/fss_embedded_list_read/c/private-print.c index 25a805e..4dbdb5f 100644 --- a/level_3/fss_embedded_list_read/c/private-print.c +++ b/level_3/fss_embedded_list_read/c/private-print.c @@ -76,7 +76,7 @@ extern "C" { if (!data->buffer.used) return; - if (data->main->parameters.array[fss_embedded_list_read_parameter_content_e].result == f_console_result_found_e) { + if (data->main->parameters.array[fss_embedded_list_read_parameter_content_e].result == f_console_result_found_e && data->main->parameters.array[fss_embedded_list_read_parameter_original_e].result == f_console_result_none_e) { const f_string_range_t before = fss_embedded_list_read_print_at_determine_begin(data, object, contents); if (before.start <= before.stop) { @@ -97,20 +97,31 @@ extern "C" { if (data->buffer.string[before.start] == f_fss_eol_s.string[0]) ++before.start; } - if (f_fss_embedded_list_open_s.used && object.stop + 1 < data->buffer.used) { - after.start = after.stop = object.stop + 1; + if (data->main->parameters.array[fss_embedded_list_read_parameter_trim_e].result == f_console_result_none_e) { + if (f_fss_embedded_list_open_s.used && object.stop + 1 < data->buffer.used) { + after.start = after.stop = object.stop + 1; - if (data->buffer.string[after.stop] == f_fss_embedded_list_open_s.string[0]) { - after.start = 1; - after.stop = 0; - } - else { - while (after.stop < data->buffer.used && data->buffer.string[after.stop] != f_fss_embedded_list_open_s.string[0]) ++after.stop; + if (data->buffer.string[after.stop] == f_fss_embedded_list_open_s.string[0]) { + after.start = 1; + after.stop = 0; + } + else { + while (after.stop < data->buffer.used && data->buffer.string[after.stop] != f_fss_embedded_list_open_s.string[0]) ++after.stop; - if (after.stop == data->buffer.used || data->buffer.string[after.stop] == f_fss_embedded_list_open_s.string[0]) --after.stop; + if (after.stop == data->buffer.used || data->buffer.string[after.stop] == f_fss_embedded_list_open_s.string[0]) --after.stop; + } } } } + + // Handle case where empty Object is empty because it has spaces and line it up with the close. + else if (data->main->parameters.array[fss_embedded_list_read_parameter_content_e].result == f_console_result_found_e) { + const f_string_range_t before = fss_embedded_list_read_print_at_determine_begin(data, object, contents); + + if (before.start <= before.stop) { + f_print_except_dynamic_partial(data->buffer, before, objects_delimits, data->main->output.to.stream); + } + } } if (before.start <= before.stop) {