mirror of
https://github.com/atom/atom.git
synced 2026-01-27 07:47:58 -05:00
Don't use font config settings in TextEditorComponent
Signed-off-by: Nathan Sobo <nathan@github.com>
This commit is contained in:
committed by
Nathan Sobo
parent
3f8b6138dc
commit
1c38dce3b2
@@ -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()
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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?
|
||||
|
||||
Reference in New Issue
Block a user