+ print_line (bold, colors, line, 0);
+ }
+ }
+}
+
+static void
+merge_print_line (bool bold, const struct color **colors, const char *line, const char *p, FILE *stream)
+{
+ char *buf = xmalloc (1);
+ char *merged_part_line = NULL;
+ const char *part_line;
+
+ *buf = '\0';
+ complete_part_line (p + 1, &buf, stream);
+
+ if (*buf != '\0')
+ part_line = merged_part_line = str_concat (line, buf);
+ else
+ part_line = line;
+ free (buf);
+
+#ifdef TEST_MERGE_PART_LINE
+ printf ("%s", part_line);
+ free (merged_part_line);
+ exit (EXIT_SUCCESS);
+#else
+ print_line (bold, colors, part_line, 0);
+ free (merged_part_line);
+#endif
+}
+
+static void
+complete_part_line (const char *p, char **buf, FILE *stream)
+{
+ bool got_next_char = false, read_from_stream;
+ char ch;
+ unsigned int i = 0;
+
+ if (get_next_char (&ch, &p, stream, &read_from_stream))
+ {
+ if (ch == '[')
+ {
+ if (read_from_stream)
+ save_char (ch, buf, &i);
+ }
+ else
+ {
+ if (read_from_stream)
+ ungetc ((int)ch, stream);
+ return; /* cancel */