From 3d21ac0742dc5fdc9c18585d81ba601e730151e9 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 9 Jan 2018 15:15:54 +0100 Subject: [PATCH 1/2] Render highlights behind lines This fixes a bug most likely introduced with #16511 by ensuring that UI elements (such as selections) never cover up the text. Signed-off-by: Nathan Sobo --- src/text-editor-component.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/text-editor-component.js b/src/text-editor-component.js index 5f0c98091..3551877b8 100644 --- a/src/text-editor-component.js +++ b/src/text-editor-component.js @@ -594,13 +594,15 @@ class TextEditorComponent { } renderLineTiles () { - const children = [] const style = { position: 'absolute', contain: 'strict', overflow: 'hidden' } + const children = [] + children.push(this.renderHighlightDecorations()) + if (this.hasInitialMeasurements) { const {lineComponentsByScreenLineId} = this @@ -653,7 +655,6 @@ class TextEditorComponent { } children.push(this.renderPlaceholderText()) - children.push(this.renderHighlightDecorations()) children.push(this.renderCursorsAndInput()) return $.div( From c48ba79f3cbe8e014a086d4ab7d4544b232879f1 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 9 Jan 2018 15:16:17 +0100 Subject: [PATCH 2/2] Prevent selection of non-text content in editor Signed-off-by: Nathan Sobo --- src/text-editor-component.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/text-editor-component.js b/src/text-editor-component.js index 3551877b8..855920b3b 100644 --- a/src/text-editor-component.js +++ b/src/text-editor-component.js @@ -3536,7 +3536,8 @@ class CursorsAndInputComponent { zIndex: 1, width: scrollWidth + 'px', height: scrollHeight + 'px', - pointerEvents: 'none' + pointerEvents: 'none', + userSelect: 'none' } }, children) } @@ -4012,6 +4013,7 @@ class HighlightsComponent { this.element.style.contain = 'strict' this.element.style.position = 'absolute' this.element.style.overflow = 'hidden' + this.element.style.userSelect = 'none' this.highlightComponentsByKey = new Map() this.update(props) }