@@ -29,45 +29,45 @@ It is a self-contained, single-pass Lua script with no external dependencies.
2929
3030- Extract the filename from a line like ` --- "a.txt" ` or ` --- a.txt ` end
3131- Strips quoting (` " ` or ` ' ` ) if present.
32- - Otherwise splits on whitespace and takes the second token.
32+ - Otherwise, splits on whitespace and takes the second token.
3333
3434### Preparing a File (` setPatchFile ` )
3535
36361 . Open ` f ` for reading
37372 . Copy its entire contents to ` f.orig `
38383 . Reopen ` f ` for writing (truncating it)
39- 4 . Store both reader (` bf ` ) and writer (` of ` ) handles end
39+ 4 . Configures both reader (` rf ` ) and writer (` wf ` ) handles and lines ( ` rl ` / ` wl ` )
4040
4141- On failure at any step, aborts cleanly and reports the I/O error.
4242
4343### Writing Remaining Context (` writeRemainder ` )
4444
45- After the last hunk of a file is applied, any lines remaining in the original (` bf ` ) are written unchanged to the new
46- file (` of ` ).
45+ After the last hunk of a file is applied, any lines remaining in the original (` rf ` ) are written unchanged to the new
46+ file (` wf ` ).
4747
4848### Diff-Line Dispatch
4949
5050Each patch-file line is classified by its first character:
5151
5252#### Additions (` + ` )
5353
54- - Lines beginning ` + ` (but not ` ++ ` ) are written to ` of ` .
54+ - Lines beginning ` + ` (but not ` ++ ` ) are written to ` wf ` .
5555
5656#### Deletions (` - ` )
5757
5858- A leading ` -- ` indicates a new filename header (` --- a.txt ` ).
59- - Other ` - ` lines are verified against ` bf :read("*l")` , then skipped (i.e. not written to ` of ` ).
59+ - Other ` - ` lines are verified against ` rf :read("*l")` , then skipped (i.e. not written to ` wf ` ).
6060
6161#### Context (` ` )
6262
63- - Lines beginning with a space must match the next line in ` bf ` .
64- - If they do, they’re copied unchanged into ` of ` ; otherwise the script errors out.
63+ - Lines beginning with a space must match the next line in ` rf ` .
64+ - If they do, they’re copied unchanged into ` wf ` ; otherwise the script errors out.
6565
6666#### Hunk Headers (` @@ ` )
6767
6868- On seeing ` @@ -oldStart,oldLen +newStart,newLen @@ ` , parse the four numbers.
6969- Before entering the new hunk, verify you consumed exactly ` oldLen ` & ` newLen ` lines since the last header.
70- - Skip any “leading context” between hunks by copying ` (oldStart − 1) − bl ` lines from ` bf ` → ` of ` .
70+ - Skip any “leading context” between hunks by copying ` (oldStart − 1) − rl ` lines from ` rf ` → ` wf ` .
7171
7272#### No-newline Marker (` \ No newline… ` )
7373
0 commit comments