Skip to content

Fix "\ No newline at end of file" line handling#10

Merged
sile merged 2 commits intomainfrom
no-newline-at-end-of-file
Feb 28, 2025
Merged

Fix "\ No newline at end of file" line handling#10
sile merged 2 commits intomainfrom
no-newline-at-end-of-file

Conversation

@sile
Copy link
Copy Markdown
Owner

@sile sile commented Feb 28, 2025

Copilot Summary

This pull request includes changes to the src/diff.rs file to handle the case of "No newline at end of file" in diffs. The most important changes include adding a new variant to the LineDiff enum, updating the ChunkDiff struct and its methods to remove the no_eof_newline field, and modifying the Display implementations accordingly.

Enhancements to LineDiff enum:

  • Added NoNewlineAtEndOfFile variant to the LineDiff enum.
  • Updated the FromStr implementation for LineDiff to handle the new variant.
  • Updated the Display implementation for LineDiff to properly display the new variant.

Modifications to ChunkDiff struct:

  • Removed the no_eof_newline field from the ChunkDiff struct.
  • Updated the ChunkDiff methods to remove handling of the no_eof_newline field. [1] [2]
  • Updated the Display implementation for ChunkDiff to remove the display logic for the no_eof_newline field.

Additional updates:

  • Added a test case to check for the "No newline at end of file" scenario in diffs.
  • Updated the DiffTreeNodeContent implementation for LineDiff to include the new variant.

@sile sile merged commit a269f76 into main Feb 28, 2025
9 checks passed
@sile sile deleted the no-newline-at-end-of-file branch February 28, 2025 10:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant