Set languageMode and softTabs in constructor, not setBuffer

The softTabs option is only in scope in the constructor, and it can
sometimes be needed if we're unable to auto-determine the softTabs
setting from the buffer.
This commit is contained in:
Ben Ogle & Nathan Sobo
2013-07-17 14:59:46 -07:00
parent ba3fa50c6e
commit 96f434f276

View File

@@ -57,6 +57,9 @@ class EditSession
@buildDisplayBuffer({tabLength})
@addCursorAtScreenPosition([0, 0])
@languageMode = new LanguageMode(this, @buffer.getExtension())
@softTabs = @buffer.usesSoftTabs() ? softTabs ? true
@state.on 'changed', ({key, newValue}) =>
switch key
when 'scrollTop'
@@ -66,8 +69,6 @@ class EditSession
setBuffer: (@buffer) ->
@buffer.retain()
@languageMode = new LanguageMode(this, @buffer.getExtension())
@softTabs = @buffer.usesSoftTabs() ? softTabs ? true
@subscribe @buffer, "path-changed", =>
project.setPath(path.dirname(@getPath())) unless project.getPath()?
@trigger "title-changed"