| 747 | } |
| 748 | |
| 749 | func (d *Differ) QFormat(aline string, bline string, atags string, btags string) (out []string) { |
| 750 | // Format "?" output and deal with leading tabs. |
| 751 | |
| 752 | // Can hurt, but will probably help most of the time. |
| 753 | common := min(count_leading(aline, '\t'), count_leading(bline, '\t')) |
| 754 | common = min(common, count_leading(atags[:common], ' ')) |
| 755 | common = min(common, count_leading(btags[:common], ' ')) |
| 756 | atags = strings.TrimRightFunc(atags[common:], unicode.IsSpace) |
| 757 | btags = strings.TrimRightFunc(btags[common:], unicode.IsSpace) |
| 758 | |
| 759 | out = []string{"- " + aline} |
| 760 | if len(atags) > 0 { |
| 761 | out = append(out, fmt.Sprintf("? %s%s\n", |
| 762 | strings.Repeat("\t", common), atags)) |
| 763 | } |
| 764 | out = append(out, "+ "+bline) |
| 765 | if len(btags) > 0 { |
| 766 | out = append(out, fmt.Sprintf("? %s%s\n", |
| 767 | strings.Repeat("\t", common), btags)) |
| 768 | } |
| 769 | return out |
| 770 | } |
| 771 | |
| 772 | // Convert range to the "ed" format |
| 773 | func formatRangeUnified(start, stop int) string { |