Function: applyUpdateHunks()
ts
function applyUpdateHunks(inputText: string, hunks: ParsedHunk[]): string;Defined in: src/lib/patch/index.ts:324
Apply an update operation's hunks to inputText. Context matching is exact and rejects ambiguity: a hunk whose old-lines match more than one location past the cursor fails rather than guessing.
The input's line-ending convention is preserved: a file containing CRLF is rejoined with CRLF, so a one-line edit stays a one-line diff rather than a whole-file newline rewrite.
Parameters
| Parameter | Type | Description |
|---|---|---|
inputText | string | The file's current text. |
hunks | ParsedHunk[] | The parsed hunks, in order. |
Returns
string
The patched text, using the input's dominant line terminator.