Stefan Beller <sbeller@xxxxxxxxxx> writes: > In a later patch, I want to propose an option to detect&color > moved lines in a diff, which cannot be done in a one-pass over > the diff. Instead we need to go over the whole diff twice, > because we cannot detect the first line of the two corresponding > lines (+ and -) that got moved. > > So to prepare the diff machinery for two pass algorithms > (i.e. buffer it all up and then operate on the result), > move all emissions to places, such that the only emitting > function is emit_line_0. > > This covers the remaining parts of fn_out_consume. name_x_tab are colored as before, which you are already aware of and we'd need to find a way to handle, but other than that, this is a no-op conversion, getting us closer to the goal of making everything go through a single funnel. > name_a_tab = strchr(ecbdata->label_path[0], ' ') ? "\t" : ""; > name_b_tab = strchr(ecbdata->label_path[1], ' ') ? "\t" : ""; > - > - fprintf(o->file, "%s%s--- %s%s%s\n", > - line_prefix, meta, ecbdata->label_path[0], reset, name_a_tab); > - fprintf(o->file, "%s%s+++ %s%s%s\n", > - line_prefix, meta, ecbdata->label_path[1], reset, name_b_tab); > + emit_line_fmt(o, meta, reset, "--- %s%s\n", > + ecbdata->label_path[0], name_a_tab); > + emit_line_fmt(o, meta, reset, "+++ %s%s\n", > + ecbdata->label_path[1], name_b_tab); > ecbdata->label_path[0] = ecbdata->label_path[1] = NULL; > }