diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/output.c | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/lib/output.c b/lib/output.c index 61fbf832..fbde490e 100644 --- a/lib/output.c +++ b/lib/output.c | |||
@@ -332,7 +332,37 @@ static inline char *fmt_subcheck_output(mp_output_format output_format, mp_subch | |||
332 | mp_subcheck_list *subchecks = NULL; | 332 | mp_subcheck_list *subchecks = NULL; |
333 | 333 | ||
334 | switch (output_format) { | 334 | switch (output_format) { |
335 | case MP_FORMAT_MULTI_LINE: | 335 | case MP_FORMAT_MULTI_LINE: { |
336 | char *tmp_string = NULL; | ||
337 | if ((tmp_string = strchr(check.output, '\n')) != NULL) { | ||
338 | // This is a multiline string, put the correct indentation in before proceeding | ||
339 | char *intermediate_string = ""; | ||
340 | bool have_residual_chars = false; | ||
341 | |||
342 | while (tmp_string != NULL) { | ||
343 | *tmp_string = '\0'; | ||
344 | xasprintf(&intermediate_string, "%s%s\n%s", intermediate_string,check.output, generate_indentation_string(indentation+1)); // one more indentation to make it look better | ||
345 | |||
346 | if (*(tmp_string + 1) != '\0') { | ||
347 | check.output = tmp_string + 1; | ||
348 | have_residual_chars = true; | ||
349 | } else { | ||
350 | // Null after the \n, so this is the end | ||
351 | have_residual_chars = false; | ||
352 | break; | ||
353 | } | ||
354 | |||
355 | tmp_string = strchr(check.output, '\n'); | ||
356 | } | ||
357 | |||
358 | // add the rest (if any) | ||
359 | if (have_residual_chars) { | ||
360 | char *tmp = check.output; | ||
361 | xasprintf(&check.output, "%s\n%s%s", intermediate_string, generate_indentation_string(indentation+1), tmp); | ||
362 | } else { | ||
363 | check.output = intermediate_string; | ||
364 | } | ||
365 | } | ||
336 | asprintf(&result, "%s\\_[%s] - %s", generate_indentation_string(indentation), state_text(mp_compute_subcheck_state(check)), | 366 | asprintf(&result, "%s\\_[%s] - %s", generate_indentation_string(indentation), state_text(mp_compute_subcheck_state(check)), |
337 | check.output); | 367 | check.output); |
338 | 368 | ||
@@ -343,6 +373,7 @@ static inline char *fmt_subcheck_output(mp_output_format output_format, mp_subch | |||
343 | subchecks = subchecks->next; | 373 | subchecks = subchecks->next; |
344 | } | 374 | } |
345 | return result; | 375 | return result; |
376 | } | ||
346 | default: | 377 | default: |
347 | die(STATE_UNKNOWN, "Invalid format"); | 378 | die(STATE_UNKNOWN, "Invalid format"); |
348 | } | 379 | } |