Add editor.autoIndentPastedText config option

This commit is contained in:
Corey Johnson
2013-01-10 09:31:57 -08:00
parent d55dfc8a6f
commit 4f0e2c1e9b
2 changed files with 30 additions and 1 deletions

View File

@@ -160,6 +160,9 @@ class EditSession
shouldAutoIndent: ->
config.get("editor.autoIndent") ? true
shouldAutoIndentPastedText: ->
config.get("editor.autoIndentPastedText") ? false
insertText: (text, options={}) ->
options.autoIndent ?= @shouldAutoIndent()
@mutateSelectedText (selection) -> selection.insertText(text, options)
@@ -220,12 +223,14 @@ class EditSession
selection.copy(maintainPasteboard)
maintainPasteboard = true
pasteText: (options={})->
pasteText: (options={}) ->
options.normalizeIndent ?= true
options.autoIndent ?= @shouldAutoIndentPastedText()
[text, metadata] = pasteboard.read()
_.extend(options, metadata) if metadata
console.log options
@insertText(text, options)
undo: ->