formats the patch for rendering within a view, meaning it's coloured and highlights selected items
(patch *Patch, opts FormatViewOpts)
| 46 | // formats the patch for rendering within a view, meaning it's coloured and |
| 47 | // highlights selected items |
| 48 | func formatView(patch *Patch, opts FormatViewOpts) string { |
| 49 | includedLineIndices := opts.IncLineIndices |
| 50 | if includedLineIndices == nil { |
| 51 | includedLineIndices = set.New[int]() |
| 52 | } |
| 53 | presenter := &patchPresenter{ |
| 54 | patch: patch, |
| 55 | plain: false, |
| 56 | incLineIndices: includedLineIndices, |
| 57 | } |
| 58 | return presenter.format() |
| 59 | } |
| 60 | |
| 61 | func (self *patchPresenter) format() string { |
| 62 | // if we have no changes in our patch (i.e. no additions or deletions) then |