Skip to content

Commit

Permalink
Fixes #80725: Fix renderFinalNewline for wrapped files
Browse files Browse the repository at this point in the history
  • Loading branch information
alexdima committed Sep 16, 2019
1 parent b644486 commit cb4775a
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/vs/editor/browser/viewParts/lineNumbers/lineNumbers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,6 @@ export class LineNumbersOverlay extends DynamicViewOverlay {
}
const modelLineNumber = modelPosition.lineNumber;

if (!this._renderFinalNewline) {
const lineCount = this._context.model.getLineCount();
const lineContent = this._context.model.getLineContent(modelLineNumber);

if (modelLineNumber === lineCount && lineContent === '') {
return '';
}
}

if (this._renderCustomLineNumbers) {
return this._renderCustomLineNumbers(modelLineNumber);
}
Expand Down Expand Up @@ -146,10 +137,19 @@ export class LineNumbersOverlay extends DynamicViewOverlay {
const visibleEndLineNumber = ctx.visibleRange.endLineNumber;
const common = '<div class="' + LineNumbersOverlay.CLASS_NAME + lineHeightClassName + '" style="left:' + this._lineNumbersLeft.toString() + 'px;width:' + this._lineNumbersWidth.toString() + 'px;">';

const lineCount = this._context.model.getLineCount();
const output: string[] = [];
for (let lineNumber = visibleStartLineNumber; lineNumber <= visibleEndLineNumber; lineNumber++) {
const lineIndex = lineNumber - visibleStartLineNumber;

if (!this._renderFinalNewline) {
if (lineNumber === lineCount && this._context.model.getLineLength(lineNumber) === 0) {
// Do not render last (empty) line
output[lineIndex] = '';
continue;
}
}

const renderLineNumber = this._getLineRenderLineNumber(lineNumber);

if (renderLineNumber) {
Expand Down

0 comments on commit cb4775a

Please sign in to comment.