diff --git a/spec/text-editor-component-spec.js b/spec/text-editor-component-spec.js index 4ced8c912..585beaedd 100644 --- a/spec/text-editor-component-spec.js +++ b/spec/text-editor-component-spec.js @@ -1217,7 +1217,7 @@ describe('TextEditorComponent', function () { }) it('accounts for character widths when positioning cursors', async function () { - atom.config.set('editor.fontFamily', 'sans-serif') + component.setFontFamily('sans-serif') editor.setCursorScreenPosition([0, 16]) await nextViewUpdatePromise() @@ -1233,7 +1233,7 @@ describe('TextEditorComponent', function () { }) it('accounts for the width of paired characters when positioning cursors', async function () { - atom.config.set('editor.fontFamily', 'sans-serif') + component.setFontFamily('sans-serif') editor.setText('he\u0301y') editor.setCursorBufferPosition([0, 3]) await nextViewUpdatePromise() @@ -1261,7 +1261,7 @@ describe('TextEditorComponent', function () { }) it('positions cursors correctly after character widths are changed via a stylesheet change', async function () { - atom.config.set('editor.fontFamily', 'sans-serif') + component.setFontFamily('sans-serif') editor.setCursorScreenPosition([0, 16]) await nextViewUpdatePromise() diff --git a/src/text-editor-component.coffee b/src/text-editor-component.coffee index e6fc0dc15..0306141d3 100644 --- a/src/text-editor-component.coffee +++ b/src/text-editor-component.coffee @@ -47,7 +47,6 @@ class TextEditorComponent @tileSize = tileSize if tileSize? @disposables = new CompositeDisposable - @observeConfig() @setScrollSensitivity(@config.get('editor.scrollSensitivity')) lineTopIndex = new LineTopIndex({ @@ -332,17 +331,6 @@ class TextEditorComponent clearTimeout(timeoutId) timeoutId = setTimeout(writeSelectedTextToSelectionClipboard) - observeConfig: -> - @disposables.add @config.onDidChange 'editor.fontSize', => - @sampleFontStyling() - @invalidateMeasurements() - @disposables.add @config.onDidChange 'editor.fontFamily', => - @sampleFontStyling() - @invalidateMeasurements() - @disposables.add @config.onDidChange 'editor.lineHeight', => - @sampleFontStyling() - @invalidateMeasurements() - onGrammarChanged: => if @scopedConfigDisposables? @scopedConfigDisposables.dispose() diff --git a/src/workspace-element.coffee b/src/workspace-element.coffee index f3bff04c6..c604f62b1 100644 --- a/src/workspace-element.coffee +++ b/src/workspace-element.coffee @@ -58,6 +58,7 @@ class WorkspaceElement extends HTMLElement } """ @styles.addStyleSheet(styleSheetSource, sourcePath: 'global-text-editor-styles') + @views.performDocumentPoll() initialize: (@model, {@views, @workspace, @project, @config, @styles}) -> throw new Error("Must pass a views parameter when initializing WorskpaceElements") unless @views?