let string_of_diff ?offset = function
    Add (i1,i2,s) ->
      let i1 = string_of_index ?offset i1
      and i2 = string_of_index ?offset i2 in
      let txt = prepend_lines "> " s in
      Printf.sprintf "%sa%s\n%s" i1 i2 txt
  | Delete (i1,i2,s) ->
      let i1 = string_of_index ?offset i1
      and i2 = string_of_index ?offset i2 in
      let txt = prepend_lines "< " s in
      Printf.sprintf "%sd%s\n%s" i1 i2 txt
  | Change (i1,s1,i2,s2) ->
      let i1 = string_of_index ?offset i1
      and i2 = string_of_index ?offset i2 in
      let txt1 = prepend_lines "< " s1 in
      let txt2 = prepend_lines "> " s2 in
      Printf.sprintf "%sc%s\n%s\n---\n%s"
        i1 i2 txt1 txt2