Use editor.softWrap config value when creating edit sessions

Closes #666
This commit is contained in:
Kevin Sawicki
2013-08-21 17:17:06 -07:00
parent 2f4db45320
commit 147e75ad95
3 changed files with 13 additions and 4 deletions

View File

@@ -66,10 +66,18 @@ describe "Project", ->
Project.unregisterOpener(barOpener)
describe "when passed a path that doesn't match a custom opener", ->
it "creates the edit session with the configured `editor.tabLength` setting", ->
it "creates the edit session with the configured `editor.tabLength` and `editor.softWrap` settings", ->
config.set('editor.tabLength', 4)
editSession = project.open('a')
expect(editSession.getTabLength()).toBe 4
config.set('editor.softWrap', true)
editSession1 = project.open('a')
expect(editSession1.getTabLength()).toBe 4
expect(editSession1.getSoftWrap()).toBe true
config.set('editor.tabLength', 100)
config.set('editor.softWrap', false)
editSession2 = project.open('b')
expect(editSession2.getTabLength()).toBe 100
expect(editSession2.getSoftWrap()).toBe false
describe "when given an absolute path that hasn't been opened previously", ->
it "returns a new edit session for the given path and emits 'buffer-created' and 'edit-session-created' events", ->

View File

@@ -24,6 +24,7 @@ class Editor extends View
nonWordCharacters: "./\\()\"':,.;<>~!@#$%^&*|+=[]{}`~?-"
preferredLineLength: 80
tabLength: 2
softWrap: false
@nextEditorId: 1

View File

@@ -373,7 +373,7 @@ class Project
defaultEditSessionOptions: ->
tabLength: config.get('editor.tabLength')
softTabs: @getSoftTabs()
softWrap: @getSoftWrap()
softWrap: config.get('editor.softWrap')
eachEditSession: (callback) ->
callback(editSession) for editSession in @getEditSessions()