diff --git a/src/text-editor.coffee b/src/text-editor.coffee index 710bd4d1e..23e77e2ad 100644 --- a/src/text-editor.coffee +++ b/src/text-editor.coffee @@ -2496,17 +2496,15 @@ class TextEditor extends Model pasteText: (options={}) -> {text, metadata} = atom.clipboard.readWithMetadata() - containsNewlines = text.indexOf('\n') isnt -1 - - if metadata?.selections? and metadata.selections.length is @getSelections().length + if metadata?.selections?.length is @getSelections().length @mutateSelectedText (selection, index) -> text = metadata.selections[index] selection.insertText(text, options) - return - else if atom.config.get(@getLastCursor().getScopeDescriptor(), "editor.normalizeIndentOnPaste") and metadata?.indentBasis? - if !@getLastCursor().hasPrecedingCharactersOnLine() or containsNewlines + if metadata?.indentBasis? and atom.config.get(@getLastCursor().getScopeDescriptor(), "editor.normalizeIndentOnPaste") + containsNewlines = text.indexOf('\n') isnt -1 + if containsNewlines or !@getLastCursor().hasPrecedingCharactersOnLine() options.indentBasis ?= metadata.indentBasis @insertText(text, options)