diff --git a/spec/app/edit-session-spec.coffee b/spec/app/edit-session-spec.coffee index 2ce626cfb..10fbd3d7e 100644 --- a/spec/app/edit-session-spec.coffee +++ b/spec/app/edit-session-spec.coffee @@ -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 " " diff --git a/src/app/edit-session.coffee b/src/app/edit-session.coffee index 1a20813cc..8d7d3f03c 100644 --- a/src/app/edit-session.coffee +++ b/src/app/edit-session.coffee @@ -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() diff --git a/src/app/editor.coffee b/src/app/editor.coffee index 40b64d64d..e8bb77dfd 100644 --- a/src/app/editor.coffee +++ b/src/app/editor.coffee @@ -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, =>