From 3fd4e571627a1d3fd9c8b8e489c11d508b4e608c Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Sat, 21 Jun 2014 02:23:59 -0600 Subject: [PATCH] Render a dummy highlight decoration to prevent artifacts When the last highlight gets removed, we get a rendering artifact. Always rendering an empty dummy at 0,0 ensures that never happens. --- src/editor-component.coffee | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/editor-component.coffee b/src/editor-component.coffee index 7f475fb1b..f1d6ceaa6 100644 --- a/src/editor-component.coffee +++ b/src/editor-component.coffee @@ -12,6 +12,8 @@ ScrollbarComponent = require './scrollbar-component' ScrollbarCornerComponent = require './scrollbar-corner-component' SubscriberMixin = require './subscriber-mixin' +DummyHighlightDecoration = {id: 'dummy', screenRange: new Range(new Point(0, 0), new Point(0, 0)), decorations: [{class: 'dummy'}]} + module.exports = EditorComponent = React.createClass displayName: 'EditorComponent' @@ -269,6 +271,12 @@ EditorComponent = React.createClass if editor.decorationMatchesType(decoration, 'highlight') filteredDecorations[markerId] ?= {id: markerId, screenRange: marker.getScreenRange(), decorations: []} filteredDecorations[markerId].decorations.push decoration + + # At least in Chromium 31, removing the last highlight causes a rendering + # artifact where chunks of the lines disappear, so we always leave this + # dummy highlight in place to prevent that. + filteredDecorations['dummy'] = DummyHighlightDecoration + filteredDecorations observeEditor: ->