File tree Expand file tree Collapse file tree 2 files changed +34
-0
lines changed
src/webviews/apps/plus/composer/components/diff Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -50,6 +50,11 @@ export class GlDiffFile extends LitElement {
5050 @state ( )
5151 private parsedDiff ?: DiffFile [ ] ;
5252
53+ // should only ever be one file
54+ get diffFile ( ) : DiffFile | undefined {
55+ return this . parsedDiff ?. [ 0 ] ;
56+ }
57+
5358 private diff2htmlUi ?: Diff2HtmlUI ;
5459
5560 override firstUpdated ( ) {
@@ -111,5 +116,7 @@ export class GlDiffFile extends LitElement {
111116 this . diffText = diffLines . trim ( ) ;
112117 const parsedDiff = parseDiff ( this . diffText ) ;
113118 this . parsedDiff = parsedDiff ;
119+ const lineCount = this . diffFile ?. blocks . reduce ( ( p , c ) => p + 1 + c . lines . length , 0 ) ?? - 1 ;
120+ this . style . setProperty ( '--d2h-intrinsic-line-count' , lineCount > - 1 ? `${ lineCount } ` : '50' ) ;
114121 }
115122}
Original file line number Diff line number Diff line change @@ -97,6 +97,27 @@ export const hljsStyles = css`
9797` ;
9898
9999export const diff2htmlStyles = css `
100+ : host {
101+ - - d2h- intrinsic- base- height: 3.5rem;
102+ - - d2h- intrinsic- line-count: 50;
103+ - - d2h- intrinsic- line-height: 1.8rem;
104+ - - d2h- intrinsic- height: calc(
105+ var (--d2h-intrinsic-base-height ) + (var(- - d2h- intrinsic- line-height) * var (- - d2h- intrinsic- line-count))
106+ );
107+
108+ dis play: block;
109+ position: relative;
110+ }
111+
112+ .d2h-file-wrapper {
113+ content-visibility : auto;
114+ contain-intrinsic-size : auto var (--d2h-intrinsic-base-height );
115+ }
116+
117+ .d2h-file-wrapper [open ] {
118+ contain-intrinsic-height : var (--d2h-intrinsic-height );
119+ }
120+
100121 .d2h-wrapper {
101122 color : var (--d2h-color );
102123 text-align : left;
@@ -427,9 +448,11 @@ export const diff2htmlStyles = css`
427448 }
428449 : host-context (.vscode-high-contrast ) .d2h-ins .d2h-code-line {
429450 border : 1px dashed var (--d2h-ins-border-color );
451+ line-height : calc (var (--d2h-intrinsic-line-height ) - 0.2rem );
430452 }
431453 : host-context (.vscode-high-contrast ) .d2h-del .d2h-code-line {
432454 border : 1px dashed var (--d2h-del-border-color );
455+ line-height : calc (var (--d2h-intrinsic-line-height ) - 0.2rem );
433456 }
434457` ;
435458/*
@@ -729,6 +752,10 @@ export const diff2htmlStyles = css`
729752 } */
730753
731754export const diffStyles = css `
755+ td {
756+ padding-block : 0 ;
757+ line-height : var (--d2h-intrinsic-line-height );
758+ }
732759 .d2h-file-wrapper {
733760 margin-block-end : 0 ;
734761 }
You can’t perform that action at this time.
0 commit comments