()
| 32 | |
| 33 | const emptyCell = (): SplitDiffCell => ({ lineNo: null, text: "", type: "empty" }); |
| 34 | const flushChanges = () => { |
| 35 | if (!current) { |
| 36 | removed = []; |
| 37 | added = []; |
| 38 | return; |
| 39 | } |
| 40 | const count = Math.max(removed.length, added.length); |
| 41 | for (let i = 0; i < count; i++) { |
| 42 | const left = removed[i] |
| 43 | ? { lineNo: removed[i].lineNo, text: removed[i].text, type: "removed" as const } |
| 44 | : emptyCell(); |
| 45 | const right = added[i] |
| 46 | ? { lineNo: added[i].lineNo, text: added[i].text, type: "added" as const } |
| 47 | : emptyCell(); |
| 48 | current.rows.push({ type: "line", left, right }); |
| 49 | } |
| 50 | removed = []; |
| 51 | added = []; |
| 52 | }; |
| 53 | |
| 54 | for (const line of text.split(/\r?\n/)) { |
| 55 | if (line.startsWith("--- ")) { |
no test coverage detected