summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-21 05:30:58 -0300
committerGabriel Schneider <[email protected]>2026-11-21 05:31:07 -0300
commited0103e9738e3cf5a7c7a91aec5adf0be2fc409a (patch)
tree99add792416c5827ce515e892f2de3274225ab30 /docs
parentd04f4acfb9af968caaa53d6cf10a486622c95400 (diff)
downloadpardes-ed0103e9738e3cf5a7c7a91aec5adf0be2fc409a.tar.gz
pardes-ed0103e9738e3cf5a7c7a91aec5adf0be2fc409a.zip
library: a patch row's text is its line without its end, said and tested: hunks.format trims a diff line's `\r` before its `\n` (and diff.Walk.step, and each of a source's lines, so the two compare) on purpose, and nothing a consumer reads said so (toilet saw a CRLF file's rows without their `\r`); the Patch doc comment, lib_syntax's, abi/wasm.zig's record and docs/typ/building.typ (the patch view, the record's text) say it now; test/consumer: a CRLF diff stacks to the LF diff's rows with no file, and with a CRLF main.c handed in its lines still match the diff's (its declaration found above `main.c:3 *`); no code changes
Co-Authored-By: Claude Opus <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'docs')
-rw-r--r--docs/typ/building.typ7
1 files changed, 5 insertions, 2 deletions
diff --git a/docs/typ/building.typ b/docs/typ/building.typ
index f2b3289f..69468042 100644
--- a/docs/typ/building.typ
+++ b/docs/typ/building.typ
@@ -184,7 +184,10 @@ nothing of the editor: each hunk under its `path:line`, what it stands in
above it, its lines behind their markers on their grounds, and the words a
changed line changed emphasised (delta's way). It returns a `Patch`, its
text and a `PatchRow` for each of its lines (row _i_ is line _i_), all in
-the arena it is handed:
+the arena it is handed. A row's text is its line without its end, the
+`\n` and a `\r` before it: a CRLF diff's rows have no `\r` (a reader that
+must show one reads it off the diff), and a file handed in as `source` is
+compared line by line the same way, so a CRLF file matches its diff.
#pairs(
[`kind`], [`other` (a mailed patch's headers, message, diffstat), `meta` (a section's own words: a mode, a rename, `Binary files ... differ`), `hunk` (its label, a star a declaration it stands in), `declaration` (what it stands in: a declaration's `path:line` and header lines from the file, or git's own words after the `@@`), `context`, `added`, `removed`],
@@ -242,7 +245,7 @@ and a row's record:
[0 `kind`], [0 other, 1 meta, 2 hunk, 3 declaration (git's words after the `@@`), 4 context, 5 added, 6 removed],
[4 `old`, 8 `new`], [its numbers in the old and the new file, from 1; 0 where it has none],
[12 `code_start`], [where its code starts in its text: after a hunk label's `path:line` and stars],
- [16 `text_offset`, 20 `text_len`], [its text, without its newline, in the header's `text`],
+ [16 `text_offset`, 20 `text_len`], [its text, without its line end (the `\n`, and a `\r` before it), in the header's `text`],
[24 `path_offset`, 28 `path_len`], [its section's path, in the header's `text` too],
[32 `flags`], [bit 0: the diff has `\ No newline at end of file` after it],
)