Use config defaults to assign default invisible characters

This commit is contained in:
Nathan Sobo 2014-08-12 14:19:04 -06:00
parent 970bde9361
commit 986753981d
3 changed files with 8 additions and 11 deletions

View File

@ -195,13 +195,12 @@ describe "WorkspaceView", ->
atom.workspaceView.height(200)
atom.workspaceView.attachToDom()
rightEditorView = atom.workspaceView.getActiveView()
rightEditorView.getEditor().setText("\t ")
rightEditorView.getEditor().setText("\t \n")
leftEditorView = rightEditorView.splitLeft()
expect(rightEditorView.find(".line:first").text()).toBe " "
expect(leftEditorView.find(".line:first").text()).toBe " "
{invisibles} = rightEditorView.component.state
{space, tab, eol} = invisibles
{space, tab, eol} = atom.config.get('editor.invisibles')
withInvisiblesShowing = "#{tab} #{space}#{space}#{eol}"
atom.workspaceView.trigger "window:toggle-invisibles"

View File

@ -59,6 +59,11 @@ class EditorView extends View
scrollSensitivity: 40
useHardwareAcceleration: true
confirmCheckoutHead: true
invisibles:
eol: '\u00ac'
space: '\u00b7'
tab: '\u00bb'
cr: '\u00a4'
@nextEditorId: 1

View File

@ -104,14 +104,7 @@ class TokenizedBuffer extends Model
setShowInvisibles: (@showInvisibles) ->
setInvisibles: (invisibles={}) ->
_.defaults invisibles,
eol: '\u00ac'
space: '\u00b7'
tab: '\u00bb'
cr: '\u00a4'
@invisibles = invisibles
setInvisibles: (@invisibles={}) ->
tokenizeInBackground: ->
return if not @visible or @pendingChunk or not @isAlive()