Remove editor.autoIndentOnPaste config option

Normalize paste on indent covers most use cases of autoindent when pasting.

Closes #584
This commit is contained in:
Corey Johnson & Matt Colyer
2013-07-16 17:08:12 -07:00
parent 2410ea0d5b
commit 4a67bfcf15
4 changed files with 0 additions and 53 deletions

View File

@@ -2334,55 +2334,10 @@ describe "EditSession", ->
editSession.insertText('foo')
expect(editSession.indentationForBufferRow(2)).toBe editSession.indentationForBufferRow(1) + 1
describe "editor.autoIndentOnPaste", ->
describe "when the text contains multiple lines", ->
beforeEach ->
copyText("function() {\ninside=true\n}\n i=1\n")
editSession.setCursorBufferPosition([2, 0])
it "does not auto-indent pasted text by default", ->
editSession.pasteText()
expect(editSession.lineForBufferRow(2)).toBe "function() {"
expect(editSession.lineForBufferRow(3)).toBe "inside=true"
expect(editSession.lineForBufferRow(4)).toBe "}"
expect(editSession.lineForBufferRow(5)).toBe " i=1"
it "auto-indents pasted text when editor.autoIndentOnPaste is true", ->
config.set("editor.autoIndentOnPaste", true)
editSession.pasteText()
expect(editSession.lineForBufferRow(2)).toBe " function() {"
expect(editSession.lineForBufferRow(3)).toBe " inside=true"
expect(editSession.lineForBufferRow(4)).toBe " }"
expect(editSession.lineForBufferRow(5)).toBe " i=1"
describe "when the text contains no newlines", ->
it "increaseses indent of pasted text when editor.autoIndentOnPaste is true", ->
copyText("var number")
editSession.setCursorBufferPosition([10, 0])
config.set("editor.autoIndentOnPaste", true)
editSession.pasteText()
expect(editSession.lineForBufferRow(10)).toBe " var number"
it "decreaseses indent of pasted text when editor.autoIndentOnPaste is true", ->
copyText(" var number")
editSession.setCursorBufferPosition([10, 0])
config.set("editor.autoIndentOnPaste", true)
editSession.pasteText()
expect(editSession.lineForBufferRow(10)).toBe " var number"
describe "editor.normalizeIndentOnPaste", ->
beforeEach ->
config.set('editor.normalizeIndentOnPaste', true)
it "does not normalize the indentation level of the text when editor.autoIndentOnPaste is true", ->
copyText(" function() {\nvar cool = 1;\n }\n")
config.set('editor.autoIndentOnPaste', true)
editSession.setCursorBufferPosition([5, ])
editSession.pasteText()
expect(editSession.lineForBufferRow(5)).toBe " function() {"
expect(editSession.lineForBufferRow(6)).toBe " var cool = 1;"
expect(editSession.lineForBufferRow(7)).toBe " }"
it "does not normalize the indentation level of the text when editor.normalizeIndentOnPaste is false", ->
copyText(" function() {\nvar cool = 1;\n }\n")
config.set('editor.normalizeIndentOnPaste', false)

View File

@@ -510,7 +510,6 @@ class EditSession
pasteText: (options={}) ->
[text, metadata] = pasteboard.read()
options.autoIndent ?= @shouldAutoIndentPastedText()
if config.get('editor.normalizeIndentOnPaste') and metadata
options.indentBasis ?= metadata.indentBasis
@@ -1288,9 +1287,6 @@ class EditSession
shouldAutoIndent: ->
config.get("editor.autoIndent")
shouldAutoIndentPastedText: ->
config.get("editor.autoIndentOnPaste")
transact: (fn) -> @buffer.transact(fn)
commit: -> @buffer.commit()

View File

@@ -21,7 +21,6 @@ class Editor extends View
showIndentGuide: false
showLineNumbers: true
autoIndent: true
autoIndentOnPaste: false
normalizeIndentOnPaste: true
nonWordCharacters: "./\\()\"':,.;<>~!@#$%^&*|+=[]{}`~?-"
preferredLineLength: 80

View File

@@ -71,9 +71,6 @@ class RootView extends View
@command 'window:toggle-auto-indent', =>
config.set("editor.autoIndent", !config.get("editor.autoIndent"))
@command 'window:toggle-auto-indent-on-paste', =>
config.set("editor.autoIndentOnPaste", !config.get("editor.autoIndentOnPaste"))
@command 'pane:reopen-closed-item', =>
@panes.reopenItem()