fold unified - #7
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds optional line-wrapping to DiffView (unified + split) to avoid horizontal scrolling, including a continuation glyph in the gutter, and updates snapshot coverage accordingly.
Changes:
- Introduce
wrapreactive switch and compose branches for wrapped unified/split rendering. - Add
FoldedLineContentvisual and gutter continuation construction. - Expand snapshot tests and recorded SVGs for wrapped modes (with/without annotations).
Reviewed changes
Copilot reviewed 3 out of 11 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
src/textual_diff_view/_diff_view.py |
Adds wrap support, new FoldedLineContent visual, and wrapped compose paths for unified/split diff rendering. |
examples/tdiff.py |
Adds w binding and binds wrap to the demo app / passes through to DiffView.load. |
tests/test_snapshots.py |
Adds snapshot tests for wrapped unified/split modes and annotation combinations. |
tests/__snapshots__/test_snapshots/test_diff_view_unified_wrap.svg |
New snapshot artifact for unified wrap mode. |
tests/__snapshots__/test_snapshots/test_diff_view_unified_wrap_annotations.svg |
New snapshot artifact for unified wrap + annotations. |
tests/__snapshots__/test_snapshots/test_diff_view_split_wrap.svg |
New snapshot artifact for split wrap mode. |
tests/__snapshots__/test_snapshots/test_diff_view_unified.svg |
Updated snapshot due to styling/layout changes from wrap-related refactors. |
tests/__snapshots__/test_snapshots/test_diff_view_unified_annotations.svg |
Updated snapshot due to styling/layout changes from wrap-related refactors. |
tests/__snapshots__/test_snapshots/test_diff_view_annotations.svg |
Updated snapshot due to styling/layout changes from wrap-related refactors. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+194
to
+196
| if line is None: | ||
| line = Content.styled("╲" * width, "$foreground 15%") | ||
| else: |
Comment on lines
+159
to
+165
| for annotate, continution, content, color, code_length in zip( | ||
| self.annotations, | ||
| self.continuations, | ||
| self.code_lines, | ||
| self.line_styles, | ||
| self.code_lengths, | ||
| ): |
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.
Added
wrapswitch to wrap lines of code that don't fit within the available width, as an alternative to horizontal scroll.Screen.Recording.2026-04-18.at.13.24.15.mov