The best way to control Claude Code, Codex and more from any computer or phone
| 1 | // A withheld file's diff line the server cut short ends in this note, which clients style apart. |
| 2 | const CUT_LINE_NOTE = / …\[[\d,]+ more characters\]$/; |
| 3 | |
| 4 | export function cutLineNote(omittedCharacters: number): string { |
| 5 | return ` …[${omittedCharacters.toLocaleString("en-US")} more characters]`; |
| 6 | } |
| 7 | |
| 8 | /** Where a cut line's note starts, past its leading space, or null for a whole line. */ |
| 9 | export function cutLineNoteStart(line: string): number | null { |
| 10 | if (!line.endsWith("more characters]")) return null; |
| 11 | const note = CUT_LINE_NOTE.exec(line); |
| 12 | return note === null ? null : note.index + 1; |
| 13 | } |
| 14 | |
| 15 | export function hasCutLines(patch: string): boolean { |
| 16 | return new RegExp(CUT_LINE_NOTE.source, "m").test(patch); |
| 17 | } |