mirror of
https://github.com/atom/atom.git
synced 2026-01-24 14:28:14 -05:00
Set auto-indent config defaults
This commit is contained in:
@@ -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 " "
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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, =>
|
||||
|
||||
Reference in New Issue
Block a user