Skip to content

Commit

Permalink
adding back line height into renderLineInput
Browse files Browse the repository at this point in the history
  • Loading branch information
aiday-mar committed Jan 9, 2025
1 parent 1e5a72e commit 1d64cc5
Show file tree
Hide file tree
Showing 8 changed files with 103 additions and 51 deletions.
3 changes: 2 additions & 1 deletion src/vs/editor/browser/viewParts/viewLines/viewLine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,8 @@ export class ViewLine implements IVisibleLine {
options.renderWhitespace,
options.renderControlCharacters,
options.fontLigatures !== EditorFontLigatures.OFF,
selectionsOnLine
selectionsOnLine,
lineHeight
);

if (this._renderedViewLine && this._renderedViewLine.input.equals(renderLineInput)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -680,7 +680,8 @@ class View extends Disposable {
options.get(EditorOption.renderWhitespace),
options.get(EditorOption.renderControlCharacters),
options.get(EditorOption.fontLigatures) !== EditorFontLigatures.OFF,
null
null,
0
));

return r.html;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,8 @@ function renderOriginalLine(
options.renderWhitespace,
options.renderControlCharacters,
options.fontLigatures !== EditorFontLigatures.OFF,
null // Send no selections, original line cannot be selected
null, // Send no selections, original line cannot be selected
options.lineHeight
), sb);

sb.appendString('</div>');
Expand Down
6 changes: 5 additions & 1 deletion src/vs/editor/common/viewLayout/viewLineRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export class RenderLineInput {
public readonly renderWhitespace: RenderWhitespace;
public readonly renderControlCharacters: boolean;
public readonly fontLigatures: boolean;
public readonly lineHeight: number;

/**
* Defined only when renderWhitespace is 'selection'. Selections are non-overlapping,
Expand All @@ -88,7 +89,8 @@ export class RenderLineInput {
renderWhitespace: 'none' | 'boundary' | 'selection' | 'trailing' | 'all',
renderControlCharacters: boolean,
fontLigatures: boolean,
selectionsOnLine: LineRange[] | null
selectionsOnLine: LineRange[] | null,
lineHeight: number
) {
this.useMonospaceOptimizations = useMonospaceOptimizations;
this.canUseHalfwidthRightwardsArrow = canUseHalfwidthRightwardsArrow;
Expand Down Expand Up @@ -117,6 +119,7 @@ export class RenderLineInput {
this.renderControlCharacters = renderControlCharacters;
this.fontLigatures = fontLigatures;
this.selectionsOnLine = selectionsOnLine && selectionsOnLine.sort((a, b) => a.startOffset < b.startOffset ? -1 : 1);
this.lineHeight = lineHeight;

const wsmiddotDiff = Math.abs(wsmiddotWidth - spaceWidth);
const middotDiff = Math.abs(middotWidth - spaceWidth);
Expand Down Expand Up @@ -172,6 +175,7 @@ export class RenderLineInput {
&& LineDecoration.equalsArr(this.lineDecorations, other.lineDecorations)
&& this.lineTokens.equals(other.lineTokens)
&& this.sameSelection(other.selectionsOnLine)
&& this.lineHeight === other.lineHeight
);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,8 @@ function renderLines(domNode: HTMLElement, tabSize: number, lines: LineData[], o
renderWhitespace,
renderControlCharacters,
fontLigatures !== EditorFontLigatures.OFF,
null
null,
lineHeight
), sb);

sb.appendString('</div>');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,12 +321,13 @@ export class StickyScrollWidget extends Disposable implements IOverlayWidget {
actualInlineDecorations = [];
}

const height = this._specialLineHeights.get(line) ?? this._lineHeight;
const renderLineInput: RenderLineInput = new RenderLineInput(true, true, lineRenderingData.content,
lineRenderingData.continuesWithWrappedLine,
lineRenderingData.isBasicASCII, lineRenderingData.containsRTL, 0,
lineRenderingData.tokens, actualInlineDecorations,
lineRenderingData.tabSize, lineRenderingData.startVisibleColumn,
1, 1, 1, 500, 'none', true, true, null
1, 1, 1, 500, 'none', true, true, null, height
);

const sb = new StringBuilder(2000);
Expand All @@ -339,7 +340,6 @@ export class StickyScrollWidget extends Disposable implements IOverlayWidget {
newLine = sb.build();
}

const height = this._specialLineHeights.get(line) ?? this._lineHeight;
const lineHTMLNode = document.createElement('span');
lineHTMLNode.setAttribute(STICKY_INDEX_ATTR, String(index));
lineHTMLNode.setAttribute(STICKY_IS_LINE_ATTR, '');
Expand Down
9 changes: 6 additions & 3 deletions src/vs/editor/standalone/browser/colorizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ export class Colorizer {
'none',
false,
false,
null
null,
0
));
return renderResult.html;
}
Expand Down Expand Up @@ -165,7 +166,8 @@ function _fakeColorize(lines: string[], tabSize: number, languageIdCodec: ILangu
'none',
false,
false,
null
null,
0
));

html = html.concat(renderResult.html);
Expand Down Expand Up @@ -205,7 +207,8 @@ function _actualColorize(lines: string[], tabSize: number, tokenizationSupport:
'none',
false,
false,
null
null,
0
));

html = html.concat(renderResult.html);
Expand Down
Loading

0 comments on commit 1d64cc5

Please sign in to comment.