Don't use font config settings in TextEditorComponent

Signed-off-by: Nathan Sobo <nathan@github.com>
This commit is contained in:
Max Brunsfeld
2016-07-27 15:23:59 -07:00
committed by Nathan Sobo
parent 3f8b6138dc
commit 1c38dce3b2
3 changed files with 4 additions and 15 deletions

View File

@@ -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()

View File

@@ -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()

View File

@@ -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?