diff options
author | aiday-mar <t-aidaym@microsoft.com> | 2022-07-26 20:04:38 +0300 |
---|---|---|
committer | aiday-mar <t-aidaym@microsoft.com> | 2022-07-26 20:04:38 +0300 |
commit | db1d08b7fdc7761002509d0b3e2f93df9f32f484 (patch) | |
tree | 8bb21779f959a4f404c6c59b575135688b1be399 /src/vs | |
parent | 9f331b70b668621f90ba9517b6fe335d8f6b4ef0 (diff) |
Force the line height to be correct, before was slightly larger than the line height inside of the editor
Diffstat (limited to 'src/vs')
-rw-r--r-- | src/vs/editor/contrib/stickyScroll/browser/stickyScroll.ts | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/vs/editor/contrib/stickyScroll/browser/stickyScroll.ts b/src/vs/editor/contrib/stickyScroll/browser/stickyScroll.ts index 8e76db3d0a4..7a21322f4e1 100644 --- a/src/vs/editor/contrib/stickyScroll/browser/stickyScroll.ts +++ b/src/vs/editor/contrib/stickyScroll/browser/stickyScroll.ts @@ -183,7 +183,7 @@ class StickyScrollController implements IEditorContribution { for (const [index, arr] of this._ranges.entries()) { const [start, end, depth] = arr; - if (end - start > 0) { + if (end - start > 0 && model.getLineContent(start) !== '') { topOfElementAtDepth = this._editor.getScrollTop() + (depth - 1) * lineHeight; bottomOfElementAtDepth = this._editor.getScrollTop() + depth * lineHeight; bottomOfBeginningLine = start * lineHeight; @@ -252,26 +252,29 @@ class StickyScrollCodeLine { newLine = sb.build(); } - const lineHTMLNode = document.createElement('div'); + const lineHTMLNode = document.createElement('span'); lineHTMLNode.style.backgroundColor = `var(--vscode-editorStickyScroll-background)`; lineHTMLNode.style.overflow = 'hidden'; lineHTMLNode.style.whiteSpace = 'nowrap'; lineHTMLNode.style.display = 'inline-block'; + lineHTMLNode.style.lineHeight = this._editor.getOption(EditorOption.lineHeight).toString() + 'px'; lineHTMLNode.innerHTML = newLine as string; - const lineNumberHTMLNode = document.createElement('div'); + const lineNumberHTMLNode = document.createElement('span'); lineNumberHTMLNode.style.width = this._editor.getLayoutInfo().contentLeft.toString() + 'px'; lineNumberHTMLNode.style.backgroundColor = `var(--vscode-editorStickyScroll-background)`; lineNumberHTMLNode.style.color = 'var(--vscode-editorLineNumber-foreground)'; lineNumberHTMLNode.style.display = 'inline-block'; + lineNumberHTMLNode.style.lineHeight = this._editor.getOption(EditorOption.lineHeight).toString() + 'px'; - const innerLineNumberHTML = document.createElement('div'); + const innerLineNumberHTML = document.createElement('span'); innerLineNumberHTML.innerText = this._lineNumber.toString(); innerLineNumberHTML.style.paddingLeft = this._editor.getLayoutInfo().lineNumbersLeft.toString() + 'px'; innerLineNumberHTML.style.width = this._editor.getLayoutInfo().lineNumbersWidth.toString() + 'px'; innerLineNumberHTML.style.backgroundColor = `var(--vscode-editorStickyScroll-background)`; innerLineNumberHTML.style.textAlign = 'right'; innerLineNumberHTML.style.float = 'left'; + innerLineNumberHTML.style.lineHeight = this._editor.getOption(EditorOption.lineHeight).toString() + 'px'; lineNumberHTMLNode.appendChild(innerLineNumberHTML); lineHTMLNode.onclick = e => { @@ -300,6 +303,8 @@ class StickyScrollCodeLine { root.style.backgroundColor = `var(--vscode-editorStickyScroll-background)`; root.style.overflow = 'hidden'; root.style.whiteSpace = 'nowrap'; + root.style.lineHeight = this._editor.getOption(EditorOption.lineHeight).toString() + 'px'; + root.style.height = this._editor.getOption(EditorOption.lineHeight).toString() + 'px'; // Special case for last line of sticky scroll if (this._position) { |