Fixes #1249: Try harder to vertically center line numbers

This commit is contained in:
Alex Dima 2016-02-02 14:40:19 +01:00
parent 083495a9fb
commit 50e49e3eef
2 changed files with 12 additions and 2 deletions

View file

@ -2,8 +2,17 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
.monaco-editor .margin-view-overlays .line-numbers {
position: absolute;
text-align: right;
cursor: url('./flipped-cursor.svg') 12.6 0, default;
}
display: inline-block;
vertical-align: middle;
box-sizing: border-box;
}
.monaco-editor .margin-view-overlays .line-numbers.lh-odd {
margin-top: 1px;
}

View file

@ -98,11 +98,12 @@ export class LineNumbersOverlay extends ViewEventHandler implements EditorBrowse
var output: IRenderResult = {};
var lineHeightClassName = (this._context.configuration.editor.lineHeight % 2 === 0 ? ' lh-even': ' lh-odd')
var lineHeight = this._context.configuration.editor.lineHeight.toString(),
lineNumber:number,
renderLineNumber:string;
var common = '<div class="' + EditorBrowser.ClassNames.LINE_NUMBERS + '" style="left:' + this._lineNumbersLeft.toString() + 'px;width:' + this._lineNumbersWidth.toString() + 'px;height:' + lineHeight + 'px;">';
var common = '<div class="' + EditorBrowser.ClassNames.LINE_NUMBERS + lineHeightClassName + '" style="left:' + this._lineNumbersLeft.toString() + 'px;width:' + this._lineNumbersWidth.toString() + 'px;height:' + lineHeight + 'px;">';
for (lineNumber = ctx.visibleRange.startLineNumber; lineNumber <= ctx.visibleRange.endLineNumber; lineNumber++) {
renderLineNumber = this._context.model.getLineRenderLineNumber(lineNumber);