Set auto-indent config defaults

This commit is contained in:
Corey Johnson
2013-01-10 10:28:24 -08:00
parent d53572d54d
commit ca41bf0709
3 changed files with 7 additions and 5 deletions

View File

@@ -1918,7 +1918,7 @@ describe "EditSession", ->
describe "auto-indent", ->
describe "editor.autoIndent", ->
it "auto-indents newlines if editor.autoIndent is undefined (the default)", ->
it "auto-indents newlines if editor.autoIndent is true", ->
config.set("editor.autoIndent", undefined)
editSession.setCursorBufferPosition([1, 30])
editSession.insertText("\n")
@@ -1930,8 +1930,8 @@ describe "EditSession", ->
editSession.insertText("\n")
expect(editSession.lineForBufferRow(2)).toBe ""
it "auto-indents calls to `indent` if editor.autoIndent is undefined (the default)", ->
config.set("editor.autoIndent", undefined)
it "auto-indents calls to `indent` if editor.autoIndent is true", ->
config.set("editor.autoIndent", true)
editSession.setCursorBufferPosition([1, 30])
editSession.insertText("\n ")
expect(editSession.lineForBufferRow(2)).toBe " "

View File

@@ -158,10 +158,10 @@ class EditSession
logScreenLines: (start, end) -> @displayBuffer.logLines(start, end)
shouldAutoIndent: ->
config.get("editor.autoIndent") ? true
config.get("editor.autoIndent")
shouldAutoIndentPastedText: ->
config.get("editor.autoIndentOnPaste") ? false
config.get("editor.autoIndentOnPaste")
insertText: (text, options={}) ->
options.autoIndent ?= @shouldAutoIndent()

View File

@@ -17,6 +17,8 @@ class Editor extends View
fontSize: 20
showInvisibles: false
autosave: false
autoIndent: true
autoIndentOnPaste: false
@content: (params) ->
@div class: @classes(params), tabindex: -1, =>