Repository navigation
Conversation
read_text/write_text translate line endings by platform, so one edit turned an LF file into CRLF on Windows and a CRLF file into LF on Linux. Read with newline="", match on LF text as before, and write the file's own ending back. A one-line edit leaves every other byte as it was. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
|
Carried forward in #66. The original commits and validation are preserved, current main is merged, and the full CI matrix is running there. Closing this PR in favor of that updated branch. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #59
edit_fileread and wrote withread_text/write_text. Those translate line endings by platform, so one edit rewrote every line ending in the file.Now it reads with
newline="". It matches on LF text, the same text as before, which is also whatread_fileshows.old_stringornew_string) is applied to the file as read. Every other byte stays as it was, mixed endings included.os.linesep).\r\ninold_stringornew_stringis read as\n. A CRLFold_stringnow matches, and a CRLFnew_stringis no longer written as\r\r\non Windows.Behavior changes, all of them:
old_stringwith\r\nused to give "not found". Now it matches the text as LF. The uniqueness check is unchanged.Tests:
old_string, LF kept with a multi-linenew_string, and a one-line edit leaving mixed endings alone. On main on Windows all three fail. With the fix they pass.ruff check corecoder testspasses.new_stringheld\r\nand main wrote\r\r\n. A file with one line ending style keeps it. A one-line edit changes no byte outside the replaced text. 58 and 66 edits that main refused now apply. In the second run I checked them: each had\r\ninold_string.Validated with Claude Opus 5.5.