@@ -26,21 +26,15 @@ const getContrastColor = (type: DiffLineType) => {
2626} ;
2727
2828/**
29- * Wrapper for diff lines - works with CSS Grid parent to ensure uniform widths
29+ * Wrapper for diff lines - provides consistent backgrounds for wrapped content
3030 *
31- * Problem: Lines of varying length created jagged backgrounds during horizontal scroll
32- * because each wrapper was only as wide as its content.
33- *
34- * Solution: Parent container uses CSS Grid, which automatically makes all grid items
35- * (these wrappers) the same width as the widest item. This ensures backgrounds span
36- * the full scrollable area without creating infinite scroll.
37- *
38- * Key insight: width: 100% makes each wrapper span the full grid column width,
39- * which CSS Grid automatically sets to the widest line's content.
31+ * Lines wrap to fit visible boundaries (no horizontal scroll). Background colors
32+ * span the full width of the container to maintain visual continuity even when
33+ * content wraps across multiple lines.
4034 */
4135export const DiffLineWrapper = styled . div < { type : DiffLineType } > `
4236 display: block;
43- width: 100%; /* Span full grid column (width of longest line) */
37+ width: 100%;
4438
4539 background: ${ ( { type } ) => {
4640 switch ( type ) {
@@ -56,7 +50,8 @@ export const DiffLineWrapper = styled.div<{ type: DiffLineType }>`
5650
5751export const DiffLine = styled . div < { type : DiffLineType } > `
5852 font-family: var(--font-monospace);
59- white-space: pre;
53+ white-space: pre-wrap;
54+ word-break: break-all;
6055 display: flex;
6156 padding: ${ ( { type } ) => ( type === "header" ? "4px 8px" : "0 8px" ) } ;
6257 color: ${ ( { type } ) => {
@@ -126,11 +121,11 @@ export const DiffContainer = styled.div<{ fontSize?: string; maxHeight?: string
126121 line-height: 1.4;
127122 max-height: ${ ( { maxHeight } ) => maxHeight ?? "400px" } ;
128123 overflow-y: auto;
129- overflow-x: auto ;
124+ overflow-x: hidden ;
130125
131- /* CSS Grid ensures all lines span the same width (width of longest line) */
126+ /* CSS Grid with content wrapping to fit visible boundaries */
132127 display: grid;
133- grid-template-columns: minmax(min-content, 1fr) ;
128+ grid-template-columns: 1fr;
134129
135130 /* Ensure all child elements inherit font size from container */
136131 * {
0 commit comments