| 32 | } |
| 33 | |
| 34 | static QList<DiffSelection> subtractSelection( |
| 35 | const DiffSelection &minuendSelection, |
| 36 | const DiffSelection &subtrahendSelection) |
| 37 | { |
| 38 | // tha case that whole minuend is before the whole subtrahend |
| 39 | if (minuendSelection.end >= 0 && minuendSelection.end <= subtrahendSelection.start) |
| 40 | return { minuendSelection }; |
| 41 | |
| 42 | // the case that whole subtrahend is before the whole minuend |
| 43 | if (subtrahendSelection.end >= 0 && subtrahendSelection.end <= minuendSelection.start) |
| 44 | return { minuendSelection }; |
| 45 | |
| 46 | bool makeMinuendSubtrahendStart = false; |
| 47 | bool makeSubtrahendMinuendEnd = false; |
| 48 | |
| 49 | if (minuendSelection.start < subtrahendSelection.start) |
| 50 | makeMinuendSubtrahendStart = true; |
| 51 | if (subtrahendSelection.end >= 0 && (subtrahendSelection.end < minuendSelection.end || minuendSelection.end < 0)) |
| 52 | makeSubtrahendMinuendEnd = true; |
| 53 | |
| 54 | QList<DiffSelection> diffList; |
| 55 | if (makeMinuendSubtrahendStart) |
| 56 | diffList += { minuendSelection.format, minuendSelection.start, subtrahendSelection.start }; |
| 57 | if (makeSubtrahendMinuendEnd) |
| 58 | diffList += { minuendSelection.format, subtrahendSelection.end, minuendSelection.end }; |
| 59 | |
| 60 | return diffList; |
| 61 | } |
| 62 | |
| 63 | DiffSelections polishedSelections(const DiffSelections &selections) |
| 64 | { |
no outgoing calls
no test coverage detected