Remove some unnecessary TextEditor accessor methods

This commit is contained in:
Max Brunsfeld
2016-08-12 14:31:07 -07:00
parent 94808303e5
commit bf644d1a6b
2 changed files with 14 additions and 24 deletions

View File

@@ -377,18 +377,6 @@ describe('TextEditorRegistry', function () {
expect(editor.hasAtomicSoftTabs()).toBe(true)
})
it('enables or disables invisible based on the config', function () {
editor.update({showInvisibles: true})
expect(editor.doesShowInvisibles()).toBe(true)
atom.config.set('editor.showInvisibles', false)
registry.maintainConfig(editor)
expect(editor.doesShowInvisibles()).toBe(false)
atom.config.set('editor.showInvisibles', true)
expect(editor.doesShowInvisibles()).toBe(true)
})
it('sets the invisibles based on the config', function () {
const invisibles1 = {'tab': 'a', 'cr': false, eol: false, space: false}
const invisibles2 = {'tab': 'b', 'cr': false, eol: false, space: false}
@@ -406,6 +394,9 @@ describe('TextEditorRegistry', function () {
atom.config.set('editor.invisibles', invisibles1)
expect(editor.getInvisibles()).toEqual(invisibles1)
atom.config.set('editor.showInvisibles', false)
expect(editor.getInvisibles()).toEqual({})
})
it('enables or disables the indent guide based on the config', function () {
@@ -445,15 +436,22 @@ describe('TextEditorRegistry', function () {
})
it('enables or disables preferred line length-based soft wrap based on the config', function () {
editor.update({softWrapAtPreferredLineLength: true})
expect(editor.doesSoftWrapAtPreferredLineLength()).toBe(true)
editor.update({
softWrapped: true,
preferredLineLength: 80,
editorWidthInChars: 120,
softWrapAtPreferredLineLength: true,
})
expect(editor.getSoftWrapColumn()).toBe(80)
atom.config.set('editor.softWrap', true)
atom.config.set('editor.softWrapAtPreferredLineLength', false)
registry.maintainConfig(editor)
expect(editor.doesSoftWrapAtPreferredLineLength()).toBe(false)
expect(editor.getSoftWrapColumn()).toBe(120)
atom.config.set('editor.softWrapAtPreferredLineLength', true)
expect(editor.doesSoftWrapAtPreferredLineLength()).toBe(true)
expect(editor.getSoftWrapColumn()).toBe(80)
})
it('sets the preferred line length based on the config', function () {

View File

@@ -847,8 +847,6 @@ class TextEditor extends Model
Section: File Operations
###
setBackUpBeforeSaving: (@backUpBeforeSaving) ->
doesBackUpBeforeSaving: -> @backUpBeforeSaving
# Essential: Saves the editor's text buffer.
@@ -2839,9 +2837,6 @@ class TextEditor extends Model
# fallback to using the `editor.tabLength` config setting
setTabLength: (tabLength) -> @update({tabLength})
# Returns a {Boolean} indicating whether atomic soft tabs are enabled for this editor.
doesShowInvisibles: -> @showInvisibles
# Enable or disable invisible character substitution for this editor.
#
# * `showInvisibles` A {Boolean}
@@ -2921,8 +2916,6 @@ class TextEditor extends Model
setSoftWrapAtPreferredLineLength: (softWrapAtPreferredLineLength) -> @update({softWrapAtPreferredLineLength})
doesSoftWrapAtPreferredLineLength: -> @softWrapAtPreferredLineLength
setPreferredLineLength: (preferredLineLength) -> @update({preferredLineLength})
getPreferredLineLength: -> @preferredLineLength
@@ -2934,7 +2927,6 @@ class TextEditor extends Model
# Essential: Gets the column at which column will soft wrap
getSoftWrapColumn: ->
scopeDescriptor = @getRootScopeDescriptor()
if @isSoftWrapped()
if @softWrapAtPreferredLineLength
Math.min(@getEditorWidthInChars(), @preferredLineLength)