| 217 | } |
| 218 | |
| 219 | function splitFile(content: string): { lines: string[]; eol: string; finalNewline: boolean } { |
| 220 | const eol = content.includes("\r\n") ? "\r\n" : "\n"; |
| 221 | const normalized = content.replace(/\r\n/g, "\n"); |
| 222 | const finalNewline = normalized.endsWith("\n"); |
| 223 | const lines = normalized.split("\n"); |
| 224 | if (finalNewline) lines.pop(); |
| 225 | return { lines, eol, finalNewline }; |
| 226 | } |
| 227 | |
| 228 | function findSequence(haystack: string[], needle: string[], from: number, endOfFile = false): number { |
| 229 | if (needle.length === 0) return from; |