Jeff King <peff@xxxxxxxx> writes: > That also means an option to something like "expand" is tough, because > "first character" really means "first non-ANSI-code character". That is true, but once you commit to the mindset that you are extending "expand", then that becomes a mere part of what must be done, i.e. if you want your "expand" to be able to handle coloured input, you'd need to know how wide each segment of the input is. For that matter, you would also want your "expand" to pay attention to the differences between display- vs byte-widths of a string, perhaps reusing utf8_strwidth() or something. Also "the first character is special" does not have to be a "diff specific hack". Your extended "expand" can take a list of tab-widths and the special case for highlighting diff output happens to take 9,8 as the "list of tab-widths" parameter (whose semantics is that each number in the list tells how wide the tab is, and the last number repeats forever, so 9,8 really means 9,8,8,8,8,...).