From 1f777addd9243c94db185d293ca29347a9d81fe3 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Thu, 16 Oct 2014 13:55:52 -0600 Subject: [PATCH] Sample font styling when font config values change MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We previously could do it whenever stylesheets changed, but these values end up getting assigned to the global stylesheet for cascading reasons and we’re only watching the local stylesheet. We poll the host elements DOM properties, but forcing a sync poll when the config values change makes behavior synchronous for specs and more responsive when changing these values. --- src/text-editor-component.coffee | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/text-editor-component.coffee b/src/text-editor-component.coffee index 7c852aa78..53c674713 100644 --- a/src/text-editor-component.coffee +++ b/src/text-editor-component.coffee @@ -416,6 +416,9 @@ TextEditorComponent = React.createClass observeConfig: -> @subscribe atom.config.observe 'editor.useHardwareAcceleration', @setUseHardwareAcceleration + @subscribe atom.config.onDidChange 'editor.fontSize', @sampleFontStyling + @subscribe atom.config.onDidChange 'editor.fontFamily', @sampleFontStyling + @subscribe atom.config.onDidChange 'editor.lineHeight', @sampleFontStyling onGrammarChanged: -> {editor} = @props